The return of the rest interface is more flexible, and can return xml, json, string and other formats according to the requester's needs

The return of the rest interface is more flexible, and can return xml, json, string and other formats according to the requester's needs;

Set the return format method:

$.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数据

            //userId=response.getElementsByTagName("id")[1].firstChild.data; //parse xml data
            //alert(userId);
            var ju="";

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325062587&siteId=291194637