【发布时间】:2011-01-20 09:40:03
【问题描述】:
大家好,
我正在使用 monorail + jquery 开发一个应用程序,我发现使用 jquery 的 ajax 存在问题。
我有一个将自身提交到 div 容器中的表单,通常工作正常,但每隔一段时间,表单不会在第一次点击时提交,我需要再次点击才能获得它工作
我已使用 Firebug 对其进行了检查,并且请求仍在处理中,如下图所示: http://www.freeimagehosting.net/uploads/c6f500d617.jpg
如果我再次按下提交按钮,则请求被处理。
我使用的代码差不多是这样的:
$('.formSteps').submit(function () { // catch the form's submit event
$.ajax({ // create an AJAX call...
data: $(this).serialize(), // get the form data
type: $(this).attr('method'), // GET or POST
url: $(this).attr('action'), // the file to call
success: function (response) { // on success..
$('#service_plan_wizard_container').html(response); // update the DIV
}
});
return false; // cancel original event to prevent form submitting
});
正如您可能猜到的,有一个名为 service_plan_wizard_container 的 div,每个带有 formSteps 类的表单都会发生这种情况。
问候
【问题讨论】: