Making an ajax call to return some data from the server. The data comes back as such:
<table border=1>
<tr>
<td>Field Name</td>
<td>Field Value</td>
</tr>
<tr>
<td>SuccessFlag</td>
<td>True</td>
</tr>
<tr>
<td>ResponseMessage</td>
<td><?xml version="1.0" encoding="utf-16"?>
<License>
<CustomerID>Bob</CustomerID>
<License>XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX</License>
<Log>Created by lt@email.com on December 6, 2012, 1:09 pm Cancelled by b@email.com on December 6, 2012, 1:09 pm</Log>
<ExpirationDate>2012-12-06</ExpirationDate>
</License>
</td>
</tr>
</table>
I am able to output the data like this:
//ajax call stuff
success: function(data) {
var answer = $(data).find("td:eq(3)").text();
var message = $(data).find("td:eq(5)").text();
if (answer==="True") {
$('input[type="text"], input[type="password"]').val("");
$('#resultGenerate').show().html('<ul><li>' + message + '</li></ul>');
} else {
$('.processing').hide();
$('input[type="text"], input[type="password"]').val("");
$('#resultGenerate').show().html('<ul><li>' + answer + '</li><li>' + message +
'</ul>');
}
}
basically I just go to the 5th td of the table and output the message. I need to format back into a table or more well constructed output. I am assuming I would create a function to parse out each tag and value pair and then run the function? Need some assistance, thank you as always!
Once you have your text just call parseXML to have jQuery turn it into an object you can work with: