Arrobefralo
New Member
this is my xml file:-\[code\]<?xml version="1.0" encoding="UTF-8" standalone="yes"?><results> <result> <Country_Code>IN</Country_Code> <Country_Name>India</Country_Name> <Region_Name>Gujarat</Region> <City>Rajkot</City> <lat>13.060422</lat> <lng>80.24958300000003</lng> </result> <result> <Country_Code>KE</Country_Code> <Country_Name>Kenya</Country_Name> <Region_Name>Vihiga</Region> <City>Kakamega</City> <lat>0.1182473</lat> <lng>34.7334515999997</lng> </result></results>\[/code\]this is my code:-\[code\]<html><head> <title>demo</title> <body> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script> var xml;$.get( "search.xml", function(data) { xml=data; }, "html"); function get_node() { var elName = $('#lat').val(); var value = http://stackoverflow.com/questions/15540266/$('#long').val(); var xPath = '/results/result[lat = '+elName+' and lng = '+value+']/lng'; var iterator = xml.evaluate(xPath, xml.documentElement, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null); var thisNode = iterator.iterateNext(); var str = ''; while (thisNode) { if (str) { str += ', '; } str += thisNode.textContent; thisNode = iterator.iterateNext(); } $("#result").text(str); } </script> <table> <td>Latitude</td><td>:</td><td><input type="text" id="lat"></td><tr> <td>Longitude</td><td>:</td><td><input type="text" id="long"></td><tr><tr></tr> <td></td><td></td><td><input type="button" value ="http://stackoverflow.com/questions/15540266/Get Details" onclick="get_node()"></td> <div id="result"></div> </table> </body></head></html>\[/code\]i have two textbox in both textbox i am enter latitude and longitude value
if the entered value is match with our xml value than its soud be return there same stage node value.
thanks.
if the entered value is match with our xml value than its soud be return there same stage node value.
thanks.