jquery,ajax多表单提交实现代码

客户端:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>生成页面</title>
<script language="javascript" src="/plus/temlates/jquery-1.7.1.min.js"></script>
<script language="javascript" src="/plus/temlates/jquery.form.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $("#form1").submit(function() {
        var options = {
            target: '#Tip',
            url: 'huizong1.php?button01=do',
            type: 'GET',
            success: function(ht) {
                if (ht == 1) {
                    alert("成汇总静态页面生成结束");
                }
            }
        };
        $('#form1').ajaxSubmit(options);
        return false;
    })
    $("#form5").submit(function() {
        var options = {
            target: '#Tip',
            url: 'djdh_bd230.php?button02=do',
            type: 'GET',
            success: function(ht) {
                if (ht == 1) {
                    alert("成汇总静态页面生成结束");
                }
            }
        };
        $('#form5').ajaxSubmit(options);
        return false;
    })
    $("#btnSubmit").click(function() {
        $("#form1").submit();
        $("#form5").submit();
    });
})
</script>
</head>
<body>
 <table width="800" border="1" align="center">
  <tr>
      <td width="800" align="center" valign="middle" bgcolor="#18B41D" colspan="2"><button id="btnSubmit" style="color:#6C0; font-weight:bold;">一键生成</button></td>
                              
    </tr>
 <tr >
      <td width="300" align="center" valign="middle" bgcolor="#18B41D" ><form id="form1" name="form1" >
  <label>
    <input type="submit" id="button" name="button012" value="点击生成汇总静态页面" />
                          
  </label>
</form></td>
      <td width="200" align="center" valign="middle" bgcolor="#18B41D"><a href="/plus/jingtai/huizong/index.html" target="_blank">浏览汇总页面</a></td>
    </tr>
  <tr>
      <td width="300" align="center" valign="middle" bgcolor="#18B41D">
                               
     <div style="display:none;"> <form id="form5" name="form5"  method="get"  >
  <label>
    <input type="submit"   id="button" value="30天总点击对话预约排序" />
                          
  </label>
</form></div>
<form id="form55" name="form55"  method="get" action="djdh_bd230.php">
  <label>
    <input type="submit"  name="button02" id="button" value="30天总点击对话预约排序" />
                          
  </label>
</form>
</td>
      <td width="200" align="center" valign="middle" bgcolor="#18B41D"><a href="/wangtengcong-zjz/plus/jingtai/djdh_bd/index301.html" target="_blank">浏览30天总点击对话预约排序页面</a></td>
    </tr>
</body>
</html>

服务器端:

if($_GET[button02]!= null){……}

参考网址:http://www.aqee.net/docs/jquery.form.plugin/jquery.form.plugin.html

你可能感兴趣的:(jquery,Ajax)