Forum Discussion

mayank's avatar
12 years ago

Lithium API to create a module to get the 3 most recent posts on other server

Lithium API to create a module to get the 3 most recent posts on other site

16 Replies

  • Code is almost ready just need to fetch post hyperlink ...but hyperlink is not coming in json format...Can you please help ....

  • $.ajax({
     url: 'url here,
        type: 'GET',
     dataType :'xml',
     async: false,
    crossDomain:true,
     success: function(data) {
     console.log(data.responseText);
     var resp = data.response;
     alert(resp);
     }
     });

     

    if i use another ajax call it show me error (In firebug)

     

    XML Parsing Error: no element found
    Location: moz-nullprincipal:{8f379bf5-ac8f-4cf9-b336-2875e210a396}
    Line Number 1, Column 1:

     

    Please help

  • AdamN's avatar
    AdamN
    Khoros Oracle
    12 years ago

    Hi mayank,

     

    I think you need to change the dataType back to "jsonp" like we were doing previously. Here's an example:

     

    $.ajax({
        url: 'http://community.edifecs.com/restapi/vc/posts?restapi.response_style=view&restapi.response_format=json',
        type: 'GET',
     dataType :'jsonp',
     async: false,
     crossDomain:true,
        success: function(data) {
    	var resp = data.response;
    	alert("First message url : " + resp.node_message_context.message[0].view_href);	 
        }
    });

     

  • It works thanks a ton again..you are genious....can you please tell why it is not printing username :

     

    alert(resp.node_message_context.message[i].login.$);

     

     

     

  • alert(resp.node_message_context.message[i].author.login.$);

     

    its working,...