www.webdeveloper.com
Results 1 to 2 of 2

Thread: Can't get XML response from jQuery/AJAX code...

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    6

    Can't get XML response from jQuery/AJAX code...

    Hi everyone,

    I have had to adapt some singular code I had from a previous project into one that is to execute at real time, but for some reason I'm at a loss as to what I'm doing wrong...

    Put simply I want it to push the received XML from the URL I've provided to a hidden form variable set in the function _L(). But for some reason that value is not coming through... Anyone have any ideas what I may be doing wrong?

    cfmParser is actually on a different server, it strips out the specific code surrounding the particular URL expressed in feedURL. So anyone outside of my network may get some cross-domain issues if they try to execute the code... But if one is to execute it, they should expect the code to be XML... But for some reason I can't seem to extract it once the code is run. I can tell you that it is sending a 200 request status code, so it is getting through on my end... here is the code.

    Code:
    var feedURL = 'http://webservice.weatherzone.com.au/rss/wx.php?u=12994-1285[amp]lt=aploc[amp]lc=' + weatherCode + '[amp]obs=1[amp]fc=1[amp]warn=1';
    var cfmParser = 'http://114.141.192.249/rssparser.cfm';
    
    $.ajax({
        type: "GET",
        url: cfmParser,
        data: {
            url: feedURL
        },
        success: function(theHtml){
            parser = new DOMParser();
            xmlDoc = parser.parseFromString(theHtml, "text/xml");
            _L(xmlDoc);
        }
    });
    I've tried a number of combinations, but my AJAX knowledge is a little lacking here...

    Any clues what I might be doing wrong?

    Thanks and Regards,

    Eliseo

  2. #2
    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    227
    You can't make AJAX requests to other servers because of the SameOrginPolicy. [link]
    New to web development or in need of a good reference? Check out the Mozilla Developer Network or W3Schools.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles