Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

401
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda