How to find namespace XML avoid other name in jQuery



I have problem with parsing XML on jQuery. I have XML file like this



<field name="scheduleItems">
<value>
<field name="programID">364</field>
<field name="programTime">05:00</field>
<field name="programTimeEnd">05:30</field>
<value>
</field>


And this is my code when use ajax for parsing



$.ajax({
type: "GET",
url: xmlFeed,
dataType: "xml",
success: function(xml) {
$(xml).find("field[name*='scheduleItems']").each(function(i, obj){
$(xml).find("value").each(function(i, obj){
var programTime = $(this).children("field[name*='programTime']").text();
var programTimeEnd = $(this).children("field[name*='programTimeEnd']").text();
});
});
},
error: function() {
console.log("has error!");
}
});


When I print result of programTime. programTimeEnd will append like this >> "programTime":"05:0005:30"


Can I resolve it. Thanks all.


No comments:

Post a Comment