我有简单的表单,我想通过 ajax 请求从表单发送数据。我试试这个:
$('form#station').submit(
function() {
console.log('form submit without reloading');
var coords = station.geometry.getCoordinates();
console.log(data);
$.ajax(
{
url: '/admin/station/add-ajax',
method: 'post',
data: {},
success: function(result) {
console.log('succcess');
}
}
);
return false;
}
);
为什么要重新加载页面?