dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: I need help to get data from xml file using javascript

  1. #1
    Join Date
    Jul 2014
    Posts
    2

    I need help to get data from xml file using javascript

    Hi everyone.
    I'm begginer in Javascript language and i need help.I'm trying to get data from web page thats actually xml file using javascript.I'm learining this and i already did example when you download xml file and have file on computer and than to extract data and i complete this, but now i need someone to help me and show me on example how to get data from xml file which is on web page and show results in new window,
    Hope somebody will help me with this and help me in my learning Javascript.

    Thanks everybody in advance.

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,498
    AJAX has a method of accessing XML

    https://developer.mozilla.org/en-US/...erializing_XML

    http://www.javascriptkit.com/dhtmltu...getpost3.shtml

    Might get you going to where you want to get to...
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  3. #3
    Join Date
    Jul 2014
    Posts
    2
    Thank you for your reply ....
    I'm actually having a problem to access data on Bing Search Api which is actually xml file and try to get some elements from that page.
    When i send XMLHttpRequest i getting null and also error about Cross Origin...It actually work when i save file on my computer as xml file and than i'm able to extract data from that file ... but when i try this way online than i'm getting errors...if someone had similar problem and if someone know how to do that please let me know and help me with that ...
    Thanks in advance.

  4. #4
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,498
    You would have a problem with getting data via AJAX like that because of something called "Same Origin Policy" as AJAX only works on the domain which served the page.

    I would suggest that you do the legwork server-side and grab the data with a cURL request, use the functionality of PHP's built in functions to process your XML and then package the data for your AJAX to collect for your page to display.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

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