This is the function call
'<div class="commentblock">' +getcomment($(this).attr("id"))+'</div>'
The function itself:
function getcomment(identifier) {
var commentmasterstring = "";
$.ajax({
type: "GET",
url: "XML/Thread_" + identifier + ".xml",
dataType: "xml",
success: function (xml) {
{
$(xml).find('comment').each(function () {
commentmasterstring +=
'<div class="commentmain">' +
'<div class="commentuser-info">' + $(this).find('owner').text() +
'</div>' +
'<div class="data">' +
'<p>' +
$(this).find('data').text() +
'</p>' +
'<p>' +
$(this).find('datetime').text() +
'</p>' +
'</div>' +
'</div>'
;
});
}
},
error: function () {
alert("The XML File could not be processed correctly.");
}
});
return commentmasterstring;
}
The XML snip:
<?xml version="1.0"?>
<!--Individual thread-->
<ThreadDetails>
<comment id="29062015080005199730">
<datetime>June 29 2015, 08:00 AM</datetime>
<owner>Jyotirmoy</owner>
<data>1: one</data> </comment>
<comment id="29062015081941086987">
<datetime>June 29 2015, 08:19 AM</datetime>
<owner>Jyotirmoy</owner>
<data>1: two</data>
</comment>
</ThreadDetails>
After execution, only an empty div gets displayed.I have checked and found the xml path is identified correctly. But, the string value assignment is causing issue. I am not able to figure it out... please help..