Im'trying提交表單而不刷新頁面,但我有問題。 當我點擊提交頁面刷新和齒輪張貼。 這是代碼,我做錯了什麼? (我是一個新手)jQuery.Form將不會提交
jQuery 1.4.2和jQuery表單插件2.43是存在的。
TNX
$(document).ready(function() {
var options = {
target: '#output2',
url: https://graph.facebook.com/<%=fbUid%>/feed,
type: post,
clearForm: true // clear all form fields after successful submit
//dataType: null // 'xml', 'script', or 'json' (expected server response type)
//resetForm: true // reset the form after successful submit
// $.ajax options can be used here too, for example:
//timeout: 3000
};
// bind to the form's submit event
$('#fbPostStatus').submit(function() {
// inside event callbacks 'this' is the DOM element so we first
// wrap it in a jQuery object and then invoke ajaxSubmit
$(this).ajaxSubmit(options);
// !!! Important !!!
// always return false to prevent standard browser submit and page navigation
return false;
});
});
使用像Firebug(用於Firefox),Chrome開發工具(用於Chrome),Microsoft Script Debugger或Visual Studio(用於IE)等等的調試器等等**真正值得**,以遍歷代碼。任何這些都會揭示Pekka和jAndy指出的腳本錯誤。 – 2010-06-07 10:38:46