I scratch my head in frustration, but I can't find the answer. I'm new to Ajax and I'm trying this easy script:
Here's my code:
JAVASCRIPT:
$(document).ready(function(){
$("#toggle_album").click(function () {
$.post('backend/load_album_thumbnails.php', {
text: 'my string',
number: 23
}, function(xml) {
var timestamp = $(xml).find("time").text();
alert(xml);
alert(timestamp);
});
});
});
the alert(xml) returns:
<? xml version="1.0"?>
<response status="ok">
<time>23:33:13</time>
<string>my string</string>
</response>
the alert(timestamp) returns empty
i have also tried:
timestamp = $("time",xml).text();
with the same result.
I added the extra space in the xml start tag because it dissapeared here on stackoverflow. The only reason for this error I can think of is that the return data isn't in XML format, but I can't figure out why that would be the case.
Appreciate any answers.