我无法提交表格。我哪里错了?
<div>
<form id = "search_form" action = "/dashboard/" method = "post">
<span class = "pull-right">
Search : <input type = "text" placeholder = "Search" id = "search">
</span>
</form>
</div>
jQuery
$("#search_form").submit(function(event) {
event.preventDefault();
var formdata = $(this).serialize();
alert(formdata);
$.ajax({
type: "POST",
url: "gallery.php",
data: formdata,
success: function(){alert('success');}
});
});
提交后,流程不会进入 jQuery 函数。为什么?