Home  >  Article  >  Backend Development  >  ajax-jQuery serialize 后续的success函数无法执行

ajax-jQuery serialize 后续的success函数无法执行

WBOY
WBOYOriginal
2016-06-02 11:28:13952browse

ajax表单jqueryphp函数

事情是这样的,我用jq serialize提交一个表单内容给php,成功之后显示“提交成功”
试了几次之后发现,我每提交一次内容,url都会有变化(就是表单内容),然后页面就会刷新,然后后面那个提交成功之后的函数它就不执行了。
如果我两次提交的内容完全一样,url没有变化,那个提交成功的函数才会执行,这是怎么回收,不是说ajax不会刷新页面的么?
以下是jq函数
$(document).ready(function(){
$("#submitform2").click(function(){
$.ajax({
type:'POST',
url: 'newalead.php',
data: $('#form1').serialize(),
success:function(){
alert('提交成功');}
});
})
})

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn