rest接口返回是比較靈活的,能夠根據請求者的需求返回xml,json,string等格式

rest接口返回是比較靈活的,能夠根據請求者的需求返回xml,json,string等格式;ajax

設置返回格式方式:json

$.ajax({
        url:'http://'+oaip+'/seeyon/rest/token/'+restup+'?loginName='+ loginName,
        type:'GET',
        headers:{Accept:"application/json; charset=utf-8"}, //直接設置http頭
        //dataType:'xml',
        //'contentType': "application/json; charset=utf-8",
        data:'',
        success: function(response){
            userId=response.id;  //解析json數據app

            //userId=response.getElementsByTagName("id")[1].firstChild.data; //解析xml數據
            //alert(userId);
            var ju="";url

相關文章
相關標籤/搜索