Hi I am really new to Jquery and have a problem with my script , I want to access the 2nd 'heading' tag in my xml file using jquery . this is my script so for but what I want to do is assign a vairiable to the 2nd value of heading .
$(document).ready(function()
{
$.ajax({
type: "GET",
url: "task.xml",
dataType: "xml",
success: displayXml
});
function displayXml(data){
$(data).find("tasks").each(function() {
var heading = $(this).find("heading").text();
});
}
}); // doc ready
this is my xml doc. What I am looking for is something like
name = $("heading",2).text(); the value being 'New Job'. Can anyone help me with this please ?
<?xml version="1.0" encoding="utf-8"?>
<tasks>
<heading>Home </heading>
<heading>New Job </heading>
<heading>System </heading>
</tasks>