php - Jquery, xml, ajax filter search -


i'm stuck! got xml this:

<butikerombud>     <butikombud>         <typ>butik</typ>         <nr>1518</nr>         <namn/>         <address1>kungsgatan 34 c</address1>         <address2/>         <address3>s-441 31</address3>         <address4>alingsÅs</address4>         <address5>västra götalands län</address5>         <telefon>0322/101 61</telefon>         <butikstyp>självbetjäning</butikstyp>         <tjanster>dryckesprovning</tjanster>         <sokord>vÄstergÖtland;storken,kristinekyrka</sokord>         <oppettider>...</oppettider>         <rt90x>6427551</rt90x>         <rt90y>1306408</rt90y>     </butikombud>     <butikombud>         <typ>butik</typ>         <nr>0704</nr>         <namn/>         <address1>storgatan 14</address1>         <address2/>         <address3>s-342 30</address3>         <address4>alvesta</address4>         <address5>kronobergs län</address5>         <telefon>0472/124 01</telefon>         <butikstyp>självbetjäning</butikstyp>         <tjanster/>         <sokord> smÅland;kronoberg;alvesta jÄrnvÄgsstation;alvesta kommunhus         </sokord>         <oppettider>...</oppettider>         <rt90x>6308791</rt90x>         <rt90y>1423876</rt90y>     </butikombud> </butikerombud> 

i want able search , i.e "gotlands län" , want return every <address1>, <address4>, , <telefon> values, or data of node, 3 important ones now.

ajax code:

 $.ajax({                     type: "get",                     url: "systembolaget.xml",                     datatype: "xml",                     success: function (xml) {                         var result = $(xml).find("butikombud").filter(function() {                           return $(this).find("address5").text().indexof('gotlands län') === 0;                         }).each(function() {                             alert("this: "+this);                                                });                         alert("result: "+result);                     },                     error: function () {                         alert("ett fel inträffade vid inläsandet av xml-filen");                     }                 }); 

i receive expected number of objects, have no clue on how read data objects (alert("this: "+this) alers 3 times, , xml contains 'gotlands län' 3 times).


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -