Autocomplete JQuery XML with Categories -
i'm working on autocomplete jquery xml data being pulled through via ajax. i'm struggling create categories each <state>.
the example shown in link below trying achieve https://jqueryui.com/autocomplete/#categories
javascript note: tjq = jquery.noconflict();
tjq(function() {  var myarr = [];  tjq.ajax({     type: "get",     url: "http://www.cyplon.co.uk/images/www.cyplon.co.uk/opa-rooms/1/js/destinations-generic.xml",     datatype: "xml",     success: parsexml,     complete: setupac,     failure: function(data) {     alert("xml file not found");    }  });  function parsexml(xml) {    tjq(xml).find("state, category").each(function()     {                 console.log(this);      label = tjq(this).find("label").attr('value');      country = tjq(this).find("country").attr('value');      destair = tjq(this).find("destair").attr('value');      wantedname = tjq(this).find("wantedname").attr('value');      resort = tjq(this).find("resort").attr('value');      category = tjq(this).find("category").attr('category');      myarr.push({'label':label,'country':country,'destair':destair, 'wantedname':wantedname, 'resort':resort,});     }); }   example xml data
<states> <state label="dubrovnik region, croatia" country="croatia" resort="" destair="dbv" category="croatia"/> <state label="dubrovnik region, croatia" country="croatia" resort="" destair="dbv" category="croatia"/> <state label="split region, croatia" country="croatia" resort="" destair="spu" category="croatia"/> <state label="split, croatia" country="croatia" resort="1723" destair="spu" category="croatia"/> </states>       
 
  
Comments
Post a Comment