locked
Using Jquery ? RRS feed

  • Question

  • I have been trying

    to build the tutorial using Jquery but it does not Work. Ajax using Jquery only works for Local Files not for Remote while WinJS XHR works

    $.get('http://theverge.com/rss/index.xml',function(data){
    console.log('Data is Here');
    });
    
    Is there a workaround for Jquery Ajax to Work.

    Edit: I have found the way to parse request data from WinJS XHR. The request data is a promise Object. You need to pick up the XML Data returned.
    However, Jquery Ajax for Cross Domain is still not working for me 

    var $xml= $(request.xml);

    If I use WinJS.xhr to do cross domain Ajax, then i process data using Jquery but that does not work either
    function processPosts(request){
    var $xml = request.responseXML.selectNodes("//item");
    $xml.find("item").each(function() {
            var $this = $(this),
                item = {
                    title: $this.find("title").text(),
                    link: $this.find("link").text(),
                    description: $this.find("description").text(),
                    pubDate: $this.find("pubDate").text(),
                    author: $this.find("author").text()
            }
            //Do something with item here...
        });
    }
    

    Kindly, Guide me  .....
     


    Friday, November 25, 2011 12:57 PM

All replies

  • Hi Engineer Head,

    When you debug this code, what is not working?  Do you get XML back?  Is it the parsing that is not working?

    -Jeff


    Jeff Sanders (MSFT)
    Monday, November 28, 2011 3:53 PM
    Moderator
  • replace the following

     var $this = $(this),

    line with 

     

    var $this = $(this);

    you were missing the ';'. Hope that helps!

    Friday, February 10, 2012 4:10 PM
  • hi..how to handle UnauthorizedAccessException $.get().error() ?
    Tuesday, February 21, 2012 1:28 PM