zoukankan      html  css  js  c++  java
  • JQuery POST请求封装

     1 _uri_api = function(url){
     2     return 'http://localhost/msquare/' + url; 
     3 //    return 'http://test2.msqsoft.net:8080/msquare/' + url; 
     4 }
     5 
     6 function post(url, data, callback) {
     7     $.ajax({
     8         beforeSend: function(reqObj, settings) {
     9 //            reqObj.setRequestHeader('Token', '73d42c6777d97d425ea3cca00087f2be76utMnRR');
    10         },
    11         type: "POST",
    12         crossDomain:true,
    13         data: data,
    14         url: url,
    15         dataType: "json",
    16         error: function(resObj, textStatus, errorThrown) {
    17             data.code = -1;
    18             callback(data, resObj.responseText);
    19         },
    20         success: function(data, textStatus, resObj) {
    21             callback(data, resObj.responseText);
    22         }
    23     });
    24 }
    25 
    26 
    27 var api = {
    28      personalInfo: {
    29          // 添加个人信息
    30          add:function(data, func) {
    31              post(_uri_api('wx/personal/addSetUpMassage'), data, func);
    32          },
    33          // 修改
    34          update:function(data, func) {
    35              post(_uri_api('wx/personal/editSetUpMassage'), data, func);
    36          },
    37          // 删除
    38          del:function(data, func) {
    39              post(_uri_api('wx/personal/deleteSetUpMassage'), data, func);
    40          }
    41      }
    42 };
  • 相关阅读:
    hide the navigationBar and tabBar
    js
    CATranstion动画
    CASpringAnimation
    UIImageView动画
    打电话发短信
    页面滑动悬停在某个控件(两种做法)
    导航栏相关设置
    ASCII和16进制
    C++中,申请字符串数组可用new实现
  • 原文地址:https://www.cnblogs.com/xjbBill/p/7306903.html
Copyright © 2011-2022 走看看