ajaxForm和ajaxSubmit 粘贴就可用

前端之家收集整理的这篇文章主要介绍了ajaxForm和ajaxSubmit 粘贴就可用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<!-- To change this template,choose Tools | Templates and open the template in the editor. --> <!DOCTYPE html> <html> <head> <title></title> <Meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script src="jquery-1.7.2.min.js"></script> <script src="jquery.form.js"></script> <script> //ajaxForm var optionss = { dataType:"text",type:'post',url: "chuli.PHP",beforeSubmit:showRequest,success:showResponse,clearForm:true }; $('#form1').ajaxForm(optionss); function showRequest() { } function showResponse(data){ alert(data); } </script> </head> <body> <form action="chuli.PHP" method="post" id="form1"> <input type="text" name="name" /> <input type="text" name="sex" /> <input type="submit" value="提交"/> </form> <hr /> <form action="chuli.PHP" method="post" id="form2"> <input type="text" name="name" /> <input type="text" name="sex" /> <input type="button" id="tijiao" value="提交"/> </form> </body> <script> //ajaxSubmit $("#tijiao").click(function(){ $("#form2").ajaxSubmit({ success:function(data){ alert(data); } }) }); </script> </html> 原文链接:https://www.f2er.com/ajax/165276.html

猜你在找的Ajax相关文章