I am having problems using an AJAX response.
Here is the JavaScript code:
- $.ajax({
- type: 'POST',
- url: ajaxurl,
- data: data,
- dataType: "JSON",
- success: function(r) {
- alert('Got this from the server: ' + r);
- alert(r.description);
- }
- });
The server uses json_encode, so the JSON is well-formed. Here is what I get from r.
Got this from the server: Array
(
[pid] => 1
[uid] => 0
[title] => 18
[description] => 18
[start] => 2010-06-13
[end] => 2010-06-13
[priority] => 1
[complete] => 0
[approved] => 1
)
{"id":"147","description":"18","title":"18","image":"today.png","completed":0}
But when I try to get the individual values such as r.description, it is undefined. What do I need to do to use the individual values?
Thanks,
John