Find element in XML using jquery -


I am using jquery to go through an XML file and find some elements and display them on the screen

  $ (xml) .find ('module'). I want to select an element in a certain position.  
  $ (xml) .find ('modulo') Like many options. [1] {$ (xml) .find ('modulo'). (1) {$ (xml) (function (index) .get ([1]) {$ (xml) .find ('Modules'). ([1]) Receive   

But nobody works till now. Does anyone know what is the right saint?

Edit: --------

  & lt; script & gt; $ Document .ready (function () {$ .ajax ({type: "GET", Url: "modulos.xml", datatype: "xml", success: ph (Xml) {$ (xml) Find ('modulo' '' '(type)' '' '' '' (type '). Text (); var date = $ (This) .Find ('Date') .text (); var firmware = $ (this) .find ('firmware'). Text (); var room = $ (this) .Find ('room') .text (); var tool = $ (This) .fin d. ('Tool') text (); var calibration = $ (this) .find ('calibration'). Text (); var next_calibration = $ (this) .find ('next_calibration' ). Text (); var rf = $ (this) .find ('rf'). Text (); var battery = $ (this) .find ('battery'). Text (); $ ('& Lt; div class = "item" id = "link _' + index + '" & gt; & lt; / div & gt;'). Html (index + "-" + MAC: "+ + MAC +" type: "+ type +" data: "+ + + firmware": "+ firmware +" sala: "+ room +" device: "+ device + "Calibrated Pound O:" + Calibration + "ProXama Calibrave Pound O:" + Next_Combination + "RF:" + + RF + "Battery:" + Battery + "
" Apendo "(# Page Here I use the code to display the whole document. P>

And here is the xml file

  ?> <> Mdulos> gt; & gt; Relative & gt; & lt; Mac & gt; foobar & lt; / mac & gt; & lt; type & Gt; foobar & lt; / type & gt; & lt; date & gt; foobar & lt; / date & gt; & lt; firmware & gt; foobar & lt; / firmware & gt; & gt; cell & gt; ; Foobar & lt; / cell & gt; & gt; Tools & gt; foobar & lt; / tools & gt; & lt; calibration & gt; foobar & lt; / calibration & gt; & lt; next_calibration & gt; foobar & Lt; / next_calibration & gt; & lt; rf & gt; foobar & lt; / RF & gt; & Lt; Battery & gt; Foobar & lt; / Battery & gt; & Lt; / Relative & gt; & Lt; Relative & gt; & Lt; Mac & gt; Foobar & lt; / Mac & gt; & Lt; Type & gt; Foobar & lt; / Type & gt; & Lt; Date & gt; Foobar & lt; / Date & gt; & Lt; Firmware & gt; Foobar & lt; / Firmware & gt; & Lt; Cell & gt; Foobar & lt; / Cell & gt; & Lt; Tools & gt; Foobar & lt; / Tools & gt; & Lt; Calibration & gt; Foobar & lt; / Calibration & gt; & Lt; Next_calibration & gt; Foobar & lt; / Next_calibration & gt; & Lt; RF & gt; Foobar & lt; / RF & gt; & Lt; Battery & gt; Foobar & lt; / Battery & gt; & Lt; / Relative & gt; & Lt; / Modulos & gt;    

create a global object like this ...

  MyRecords = {MAC: "", Type: "", Date: "", Firmware: "", Rooms: "", Tools: "", Calibration: "", Next_Combusion: "", RF: "", Battery: ""}; Myfunction () {$ .ajax ({type: "GET", url: "modulos.xml", datatype: "xml", success: function (xml) {$ (xml) .find ('modulo'). Function (index) {myRecords.Mac [index] = $ (this) .find ("Mac"). Text (); myRecords.Type [index] = $ (this) .find ("type"). Text () ; MyRecords.Date [index] = $ (this) .find ("date"). Text (); .. and so on}}   

So when you want to print all the Mac To say so in the record

  (var val in myRecords) {Warning (myRecords [val]. MAC)}}   

Answer me Hope you have

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -