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             })
原文地址:https://www.cnblogs.com/Abner5/p/5947988.html