html里的ajax数据传输

 1 var $form = $('#form')
 2             $('.lgbtn').click(function() {
 3                 //e.preventDefault();
 4                 var form = $('#form').validator('isFormValid');
 5                 if(form) {
 6                     var data = $form.serialize();
 7                     $.post('/mobile/login', data, function(d) {
 8                         if(d.status) {
 9                             Cookies.set('MemID',d.Data.MemberID);
10                             alert("登陆成功");
11                             window.location.href = "activityshop.html"
12                         } else {
13                             alert(d.message);
14                         }
15                     })
16                 } else {
17                     alert('请正确填写账号和密码')
18                 }
19             })

 

posted @ 2016-10-11 09:13  李大白程序员  阅读(848)  评论(0编辑  收藏  举报