首页 > 其他 > 详细

ajaxForm和ajaxSubmit 粘贴就可用

时间:2014-02-12 00:26:28      阅读:327      评论:0      收藏:0      [点我收藏+]
<!--
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>

ajaxForm和ajaxSubmit 粘贴就可用

原文:http://blog.csdn.net/qq1355541448/article/details/19081523

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!