【发布时间】:2016-04-22 20:28:24
【问题描述】:
我有一个 php 表单并在此页面上使用以下功能:testsite.com/local-places
jQuery(".submit").click(function() {
var dataString = jQuery("form#localsearch").serialize();
$.ajax({
type: "GET",
url: "/index.php",
data: dataString,
success : function( response ) {
alert( response );
}
});
return false;
});
提交表单后,url 如下所示:testsite.com/local-places/?post_type=local&localtype=food-drink&category_name=northwest-austin
有没有办法删除 /local-places/ 以结束:testsite.com/?post_type=local&localtype=food-drink&category_name=northwest-austin
提前致谢!
【问题讨论】:
-
你返回的是 false,所以当你提交表单时 URL 不应该改变?
-
return false 所以页面不会重新加载
标签: jquery ajax forms url submit