Thursday, 22 August 2013

JQuery Ajax returns an error

JQuery Ajax returns an error

I am using this code :
$.get("games.php?x="+x+"&o="+o, function(xml,status) {
$("#game").empty();
var row;
$(xml).find("value").each(function(index, value) {
if ( index % 3 == 0) {
row = $("<tr></tr>");
$("#game").append(row);
}
console.log($("<td width=\"50\"
height=\"50\"></td>").text(value));
row.append($("<td width=\"50\"
height=\"50\"></td>").text(value));
});
});
and im catching the Ajax errors with this :
$.ajaxSetup({
error: function(xhr, status, error) {
alert("An AJAX error occured: " + status + "\nError: " + error);
}
});
You can see it work here in the site im building for a web course :
http://62.219.127.85/sites/2013b/xox/xo.php?x=7&o=8
and see that the return xml is valid and correct :
http://62.219.127.85/sites/2013b/xox/games.php?x=7&o=8
To those who dont want to get in the site, it returns :
<game>
<x>
<id>7</id>
<id>Ofek Ron</id>
</x>
<o>
<id>8</id>
<id>Avi Fahima</id>
</o>
<value>o</value>
<value>x</value>
<value>-</value>
<value>x</value>
<value>0</value>
<value>x</value>
<value>x</value>
<value>o</value>
<value>o</value>
</game>
Yet i get this weird error on the get request, which is very uninformative
"error" is all the info they could give me, and now im stuck! can anyone
help?

No comments:

Post a Comment