• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

loading xml in JavaScript not working

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've got some setting somewhere that must be missing because I just can't get an xml file to load via JavaScript - I'm using the Spring & Tiles framework

example xml file:


jsp tile page:



I've tried changing the xml location from "/tiles/search_bar/music.xml" to just about everywhere on the server, but always get the same results.
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi above,

Welcome to Javaranch,

you didn't tell us about the error. or if this xml file in the current directory then try to access with "./title/search_bar/music.xml".

for the error checking use JavaScript console in Firefox.

hope it helps.
 
J Knurek
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the reply - the only message I'm getting is
'xmlDoc is undefined'

and when I place in various places in the code I just get 'null'

I set up and changed it to which shows my image but still doesn't load the xml

I'm using Apache Tomcat 6.0.18 if that means anything (and I'm not using Struts so I'm not too sure why the post was moved here?)
 
J Knurek
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
silly me, i posted this problem on another forum and was reminded that JavaScript runs client side and I was trying to access a file server side
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i posted this problem on another forum and was reminded that JavaScript runs client side and I was trying to access a file server side


I don't understand this comment. Client-side JavaScript is perfectly capable of retrieving XML from the server; that's the whole point of AJAX.

Have you tried using an absolute URL (that includes the server name and protocol), instead of relative URLs?
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


try this with put your xml into the same folder..
 
Hey! You're stepping on my hand! Help me tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic