[jQuery] Simple? jQuery + AJAX + HTML + XML
Hi,
I''ve got a problem with extracting a piece of HTML from a piece of
XML returned as a response to an AJAX call.
The xml is as follows
<?xml version="1.0"?>
<response>
<status>0</status>
<data>
<![CDATA[<table><tr><td><a href="#"><img style="border:0;"
src="image/b_del.png"/></a></td><td>16/03/2006</td></tr>
<tr><td><a href="#"><img style="border:0;" src="image/
b_del.png"/></a></td><td>1</td></tr></table>]]</data>
<message></message>
</response>
On detecting a status of zero I want to extract the HTML in the data
element and place it in a DIV in my page. I appreciate this question
as been asked a number of time, but this is driving me crazy. I've
posted the code below ...
$("#AddDate").click(function()
{
$.post("testEvent.php",
{ cmd: "ad", val: $
("#newCourseDate").val() },
function(response)
{
if ($("status", response).text() != 0)
{
// something is not right
alert($("message", response).text());
}
else
{
// replace the existing dates with the
new ones
$
("#eventDates").empty();
$("#eventDates").html($("data", response).text());
}
});
});
I'm sure this is something simple .... please help ... this is driving
me crazy aggghhhh
Thanks in advance
gG