欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Ajax調(diào)用restful接口傳送Json格式數(shù)據(jù)的方法

 更新時(shí)間:2016年07月09日 15:18:25   作者:愛(ài)代碼也愛(ài)生活  
這篇文章主要介紹了Ajax調(diào)用restful接口傳送Json格式數(shù)據(jù)的方法的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,感興趣的朋友一起看下吧

ajax傳送json格式數(shù)據(jù),關(guān)鍵是指定contentType,data要是json格式

如果是restful接口,把type改成對(duì)應(yīng)的post(增)、delete(刪)、put(改)、get(查)即可

var post_data={"name":"test001","pass":"xxxx"}; 
$.ajax({ 
  url: "http://192.168.10.111:8080/uc/login", 
  type: 'post', 
  contentType: "application/json; charset=utf-8", 
  data:JSON.stringify(post_data), 
  success:function (data) { 
    //調(diào)用成功 
  }, 
  error: function(data, textStatus, errorThrown){ 
    //調(diào)用失敗 
  } 
}); 

以上所述是小編給大家介紹的Ajax調(diào)用restful接口傳送Json格式數(shù)據(jù)的方法的全部敘述,希望對(duì)大家有所幫助,如果大家想了解更多內(nèi)容敬請(qǐng)關(guān)注腳本之家網(wǎng)站!

相關(guān)文章

最新評(píng)論