html - Containing an XML nodevalue with jQuery -
My prediction:
I have some things on my server that I connect to an AJAX call I want to:
-
An XML file
-
An HTML test index
-
A folder full of HTML copies
-
Some jQuery scripts
XML are the relative addresses of HTML copies. JQuery is considered to capture that nodeview and some DIV which is on the Test Index page. After all, the index page should update some of its HTML without fully reloading, as if my AJAX has read as it has said.
Unfortunately, I do not know what I'm doing.
I am working with it:
$ (document) .ready (function () {$ ('# header'). ($ '(' P # test ') .HTML (' at least
function '); $ .aex ({type: "GET", url : "Archives.xml", dataTip: "xml", success: function (xml) {$ ('div # viewer'). Attachment ($ (this) .fund ('title')). Text ();}} );});}); My AJAX call does nothing I can tell that I am doing something wrong, but at this time I am happy That i got dome 4 errors and unexpected
And here is a test XML that I'm trying to call Navigate and take data from:
Gt; & lt; entry & gt; & lt; date & gt; & lt; years & gt; 2011 & lt; / year & gt; & lt; month & lt; / month & gt; & lt ; Day> 1 & lt; / day & gt; & lt; / Date & gt; & lt; title & gt; Trees & lt; / title & gt; & lt; Deck & gt; Does not have a tree & lt; / Deck & gt; & Lt; Source & gt; ./ Copy / 1april2011.html & lt; / Source & gt; & Lt; / Entry & gt; & Lt; / Archives & gt; I already know:
-
I know JavaScript can not access a local file system. These are all issues I am running online.
-
jQuery selectors have speculated that XML DOM does not play well? At least this is that I have gathered from various blogs of the last five or six years.
-
I know about JSON, but I get XML from JSON The whole braces and bracket syntax is a bit confusing.
Question:
-
What's wrong with my success story? This imitates the tutorial I've read, but I'm clearly messed up.
-
Once I assume a value from XML, then I am able to read that value to a variable like outside AJAX calls Are you
Here is a demo$ (document) .ready (function () {$ ('# header') Click (function () {$ ('P # test'). Html ('at least & amp;; em> it & lt; / Em & gt; work '); $ .ajax ({type: "gET", url: "archives.xml", datatype: "xml" success: function (xml) {xmlDoc = $ .parseXML (xml), $ xml = $ (XmlDoc), $ title = $ xml.find ("title") .text (); $ ('div # viewer') attached ($ title);}});} );});
-
-
Comments
Post a Comment