Col*_*tor 6 forms jquery jquery-plugins
参考插件:http: //malsup.com/jquery/form/#getting-started
我最近尝试从旧的v2.28升级到v2.96,但是因为在尝试使用FireFox提交已使用另一个Ajax调用加载的表单时似乎引入了新的错误.
我有两种形式:我没有Ajax调用加载的形式和我从服务器加载的其他形式.我使用ajaxForm()进行绑定:
function bindAjaxResponse() {
// Bind for Ajax POST
var options = {
delegation: true,
//target: '#output1', // target element(s) to be updated with server response
beforeSubmit: showRequest, // pre-submit callback
success: showResponse // post-submit callback
};
$('#my_form').ajaxForm(options);
}
Run Code Online (Sandbox Code Playgroud)
在Chrome和IE中,代码都运行良好,并且调用showRequest和showResponse并填充适当的参数.使用最新的FireFox(v10.0.2)时,只调用showRequest,但从不调用showResponse.FireBug清楚地表明根本没有提交.控制台窗口中没有错误消息或警告.我真的不知道什么会引发这种行为上的差异.
请注意,所有这些代码都适用于旧版本v2.28中的所有浏览器
任何人?
问题交叉发布在https://forum.jquery.com/topic/jquery-form-plugin-not-responding-well-with-firefox
谢谢
我也遇到了jQuery表单的问题,所以我直接调用$ .ajax:
function bindAjaxResponse() {
// Bind for Ajax POST
$('#my_form').submit( function() {
var datastream = $(this).serialize();
console.log('Submitting form');
$.ajax({
type: 'post',
url: $(this).form.attr('action'),
data: datastream,
timeout: 2000,
error: function() {
console.log("Failed to submit");
},
success: function(data) {
console.log('Successfully submitted form');
console.log(data);
}
});
return false;
});
}
Run Code Online (Sandbox Code Playgroud)