ajaxSubmit

表单:

 <form id="form"  method="post" class="form-horizontal">

  <input type="text"  name="" value="">

  <button class="btn submit-btn ajax-post hidden" id="submit" type="submit" target-form="form-horizontal">确 定</button>

 </form>

 

js:

var options = {
  url: "http://"+document.domain+"{:U('param?param='.$model['id'].'&id='.$data['dev_id'])}", // target element(s) to be updated with server response


  //beforeSubmit: showRequest, // pre-submit callback


  success: function(data){
    showResponse(data);
  } // post-submit callback
}

$('#submit').click(function(){
  
  $('#form').ajaxSubmit(options);
  // !!! Important !!!
  // always return false to prevent standard browser submit and page navigation
  return false;

});

posted @ 2017-04-25 09:59  会飞的小虫子  阅读(140)  评论(0编辑  收藏  举报