大家好我试图编译并将一些表单发送到php文件,但我注意到它很慢,即使在PHP中我只有var_dump的POST值,它需要同样的时间如果我运行我的正确功能。 也许代码错了,这就是我想要做的事情:
$("#button").click(function(){
$("#button").css("border","2px solid blue");
var total_forms = $("input[name=total_forms]").val();
$.ajax( {
type: "POST",
url: "<? echo "myurl.php";?>",
data: {delete : 1}, //before sending my forms i need to run another function that delete some items in mySQL DB
success: function(data) {
for(var i = 0; i < total_forms; i++){
var string_ok = "#form_number_";
string_ok = string_ok.concat(i);
var dataString = $(string_ok).serialize();
$.ajax( {
type: "POST",
url: "echo "myUrl.php;"",
data: dataString,
success: function(data) {
console.log(data); //it's a bit faster, only a bit
$("#mydiv").append(data); //it's a bit slower
}
});
}
}
});
});
我忘了说我在MAMP上运行它的8GB内存和只有10GB的固态硬盘,也许我的电脑就是问题,IDK ..
编译需要大约4分钟,发送到PHP并为500个数据标记数据
这是我发送的dataString的一个例子:
prd_number=1259&prd_max_number=1763&old_prd_id=0&prd_action=true&title=INFORMAT%20G1X85A%23A80&title_check=true&old_title_text=&new_image_url=&old_image_url=&is_mech=&image_check=true&new_cat=Informatica%2CINFORMAT&category=true&new_price_text=222.04&price=true&new_sku_text=888182658918&oth=true&ncw=negat&stwe=testing&mark_text=INFORMAT_G1X85A%23A80&check_two=true&other_sto=table&var2=true&elemt=&weight=true&qt=3&qslow=true&clients=Norman%2Cli&taking=true&setting=normal&vars_set=true
我注意到如果我使用console.log(dataString),控制台会首先标记所有dataString日志,然后开始打印每个php响应。
答案 0 :(得分:0)