Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

396
Views
node.js + jQuery,ajax send array or json to server, payload too large.

for example: jQuery:

var sendTemp=[];
var t={
   string:'this is test string1',
   time: '2017-03-20T04:25:06.584Z',
   type:'file',
   location:'usa',
   broken:false,
}

I test the var max value array to send server, when max > 500~600 server return error message payload too large problem.

var max=600;
for(var i=0;i<max;i++){
    sendTemp.push(t);
}
$.ajax({
    async:false,
    url:"/send",
    type:"POST",
    data:{
        sendTemp:JSON.stringify(sendTemp),
    },
    success:function(data){

    },
    error:function(jqXHR, textStatus, errorThrown){

    }
});

I found a solution but did not work,in app.js

node.js:

set limit:

var bodyParser = require('body-parser');
app.use(bodyParser.json({limit: '50mb'}));
app.use(bodyParser.urlencoded({limit: '50mb', extended: true}));

set port:

 app.post('/send',function(req, res, next){  
      console.log(req.body);
      res.end();
    });
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I faced same issue. I did ajax post and got 413 payload too large error. By checking net and documentation I solved this problem by setting limit directly to body-parser.

app.use(bodyParser({limit: '50mb'}));

I hope this will be useful.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!