I am a new guy, and only learn to program as little as possible. I have been programming since the early 1970's and have written many programs in C. By the time I construct things in my head, it is like pulling fingernails to actually write the code. That said:
I want to use javascript to create item links. I want to use the item numbers to get the information needed from an XML object. Here is an example of the XML object that I can query:
I need to get at least the item's name and quality id into my own variables (preferably javascript variables) that can be used to create links like the one below the "Under Construction" sign on this page:
The short answer is that you need to look into some AJAX - look for a tutorial or two and check whether they are using the same setup as you are - ie do they rely on Prototype, jQuery or similar.
Neither javascript or AJAX can parse xml from a different domain for security reasons. You can import the xml to your domain and then parse it. This is easily done in php. You can either create a "proxy" (a nice example here) and parse it on the client side or you can retrieve the xml (and cache it if it is fairly static) and parse it on the server side. Lots of different php options for this route.
Neither javascript or AJAX can parse xml from a different domain for security reasons. You can import the xml to your domain and then parse it. This is easily done in php. You can either create a "proxy" (a nice example here) and parse it on the client side or you can retrieve the xml (and cache it if it is fairly static) and parse it on the server side. Lots of different php options for this route.
Yep, my stupidity is terminal. I wrote an AJAX script to load the XML from the other server. I came here this time to ask why the ***.readyState would not increase beyond the value of 1, and there was your answer as the last post.
Thanks opifex,
I am off to the realm of PHP. I'll get back on when I reach a block on that one. It will probably take my old slow mind a a few days to learn enough that I realize there is something else, simple as can be, that I am lacking in knowledge. I have learned a lot from the study of AJAX and DOM. Maybe even enough to parse this thing once I get it onto my server
EDIT:
Looked at the proxy routine. Nice but I think it unnecessary until I break down and try to write a tunnel proxy for my travels.
I can load the XML to my server, the content is fairly static, and can be reloaded when it happens to change (once every couple of months perhaps). Would opifex or someone else have a link to a PHP routine to cache XML from another server to my own?
Do you have a reference to code that would save xml from one server onto my own? I noticed in the script you wrote for a proxy server, that you simply opened the remote server with the fopen and read it in 4096 chunks. Would I simply open it and the write it to a local file.
THIS is probably one of the cleanest examples around. I recently used this snippet as the base for weather feed reader. It shortened my old code by more than half.
Will only run on PHP5.
Bookmarks