ajax提交form表单

  1. 这是一个form表单实例
  2. <form id ="fm" method="post" action="/SearchInfo/QueryMoreInfo" >  
  3.               
  4.       <div>  
  5.   
  6.       <table id="searchInfo"  style="width: auto; height:auto; margin: 8px" title="基本信息" iconcls="icon-edit">  
  7.         </table>  
  8.               
  9.           <input id ="setGuid" name="setGuid" type="hidden">   
  10.         
  11.        </div>  
  12.               
  13.  </form>
  14. 以下为运用ajax的代码:
    1. $.ajax({  
    2.                 type: "POST",  
    3.                 url:"SearchInfo/QueryMoreInfo",  
    4.                 data:$('#fm').serialize(),// 序列化表单值  
    5.                 async: false,  
    6.                 error: function(request) {  
    7.                     alert("Connection error");  
    8.                 },  
    9.                 success: function(data) {  
    10.                     window.location.href="跳转页面"  
    11.                 }  
    12.             }); 

posted on 2017-03-06 15:18  臣风少年闯天涯  阅读(228)  评论(0编辑  收藏  举报

导航