我创建了一个非常昂贵的php类,需要在管理页面上处理很多请求。由于这个原因,我试图使用jquery queing + ajax调用来批量处理请求,但是整个javascript没有解雇,我不明白为什么。我更喜欢js或jQuery的PHP专家。消息队列+ ajax没有触发
的代码:
$(document).ready(function() {
window.queue = $.jqmq({
// Queue items will be processed every 250 milliseconds.
delay: 500,
// Process queue items one-at-a-time.
batch: 10,
// For each queue item, execute this function.
callback: function (model, apit) {
$.ajax({
url: 'script.php',
type: "post",
cache: false,
data: "model=" + model + "&api=" + apit,
success: function (data) {
$(".error_msg p").append(data);
}
},
// When the queue completes naturally, execute this function.
complete: function() {
$.ajax({
url: 'script.php',
type: "post",
cache: false,
data: "cleanup=1",
success: function (data) {
$(".error_msg p").append(data);
}
$('.error_msg p').append('Queue done');
}
});
//the next line is repeated a couple hundred times with different values
queue.add('arg1', 'arg2'); queue.add('arg1', 'arg2');
});
此代码位于在体内。包括(在头) 脚本是:
我已经与TamperData FF插件和AJAX的职位,以script.php的只是没有发射检查,我不知道为什么..
2012-07-10
stevesrs