net :: ERR_EMPTY_RESPONSE当使用ajax发布时 [英] net::ERR_EMPTY_RESPONSE when post with ajax

查看:269
本文介绍了net :: ERR_EMPTY_RESPONSE当使用ajax发布时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我试图一个一个地上传一个xlsx文件,所以我可以显示一个状态栏,问题是,我使用for循环来完成它,而while循环通过ajax发送了一个请求,但是当它在第40个元素上时停止并且控制台显示POST(site.php)net :: ERR_EMPTY_RESPONSE,我尝试在localhost中执行它,并且工作正常,但是当AI尝试在我的外部服务器(godaddy)上执行此操作时,它将显示错误.这是代码.

Hello im trying to upload a xlsx file one by one so i can show a status bar, the problem is, i did it with a for loop and while loop sending a request via ajax, but when is on the 40th element it stops and the console shows POST (site.php) net::ERR_EMPTY_RESPONSE, i tried to do it in the localhost and it works perfect, but when a i try to do it on my external server(godaddy) it shows the error. here is the code.

for(j=1;j<=tama;j++){
        $.ajax({
            type: "POST",       
            url: "ejphp.php",
            dataType: "json",
            data: {vals: regs, j:j},
            success: function(datos){ 
                console.log(j)
                prog=datos['progreso_r'];
                var id_vac=datos['id_vac']
                var tipo=datos['tipo']
                var tipo2=datos['tipo2']
                var tot_ing=datos['tot_ing']
                prog_p=Math.round(prog*100/tama);       
                $("#progressbar").val(prog_p);
                $("#progreso").text(prog_p+'%');
                $("#datos_vac").text('Id Vacuno: '+id_vac);
                if(prog_p==100){ 
                    $("#aceptar").show("slow");                     
                }
                if(tipo=='error') registro(tipo2, id_vac)
                subir(parseInt(prog)+1);
                return false;
            }
        })
    }

推荐答案

也许您的服务器不能传递40个以上的请求,请尝试增加php内存限制和执行时间.并尝试在Godaddy的管理面板中浏览.

Maybe your server can't pass more than 40 requests, try to increase php memory limit and execution time. And try to browse in godaddy's admin panel.

这篇关于net :: ERR_EMPTY_RESPONSE当使用ajax发布时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆