Problem
I'm trying to log the data returned from a JSON call, and console.log(jsonData)
doesn't seem to be working.
Code
$(document).ready(function() {
$("#users li a:first-child").click(function() {
var id = this.href.replace(/.*=/, "");
this.id = "delete_link_" + id;
if(confirm("Are you sure you want to delete this user?"))
{
$.getJSON("delete.php?ajax=true&id=" + id, function(data) {
console.log(data.success);
});
}
return false;
});
});
Returned by delete.php
{"id": $id, "success": 1}
upon success.{"id": $id, "success": 0, "error": "Could not delete user."}
upon failure.