为什么会出现错误:
jQuery('#the_form').submit(function() {
jQuery.ajax({
url: 'stats.php?increment=true',
success: function() {
alert('Load was performed.');
},
error: function() {
alert('Load wasnt performed.');
}
});
return true;
});
Run Code Online (Sandbox Code Playgroud)
而这不是(返回是假的,其他一切都是一样的):
jQuery('#the_form').submit(function() {
jQuery.ajax({
url: 'stats.php?increment=true',
success: function() {
alert('Load was performed.');
},
error: function() {
alert('Load wasnt performed.');
}
});
return false;
});
Run Code Online (Sandbox Code Playgroud)
如何在提交之前调用该脚本(对外部操作)?