我有以下页面edit_profile.php是表单所在的页面,ajax/update_profile.php是通过 ajax 发送数据的页面。 <script type="text/javascript"> $(document).ready(function () { $("#update_profile").click(function() { var updateprofile = $("#update_profile_form").serialize(); $.post( "ajax/update_profile.php", updateprofile ).done(function(data) { //alert("Successfully submitted!"); $("#result").html(data); }).fail(function () { //alert("Error submitting forms!"); }) }); }); </script>问题是在ajax响应之后它只是像浏览器上的F5一样重新加载 edit_profile.php页面,页面不重新加载怎么办?
1 回答
红糖糍粑
TA贡献1815条经验 获得超6个赞
写
$("#update_profile").click(function(e) {
e.preventDefault(); //to prevent do action
- 1 回答
- 0 关注
- 99 浏览
添加回答
举报
0/150
提交
取消