Hello, I need to get data from an XML file. I loaded it, and I can use it..
But I don't know how to get a specific value...
I know it's lil bit complicated to understand, but please help me. :(
My XML file looks like this :
- <departement>
<num>01</num>
<ensoleillement>1019</ensoleillement>
<revenus>61.15</revenus>
</departement>
<departement>
<num>02</num>
<ensoleillement>822.5</ensoleillement>
<revenus>49.4</revenus>
</departement>
<departement>
<num>03</num>
<ensoleillement>1021</ensoleillement>
<revenus>61.3</revenus>
I want to get the 'ensoleillement' and 'revenus' innerhtml of the 'departement' which has innerhtml's num : $('#departementInpt').val().
For example I have
- <input type="hidden" value="02" id="departementInpt" />
If I want to get the innerhtml of 'ensoleillement' and 'revenus' which goes with <num>02</num> !
It will return me : 822.5 and 49.4.
I tried to use
- $(xml).find('num').text( $('#departementInpt').val() ).parent().find('ensoleillement').text();
- $(xml).find('num').text( $('#departementInpt').val() ).parent().find('revenus').text();
But unfortunatly text() doesn't work here. :s
Any help ? Thanks a lot in advance.