Something weird is going on, my AJAX Request is returning a array but the whole thing is a string itself.
This basically sums it up:
PHP
$item = array();
$item[] = array(
'title' => 'awesome title',
'permalink' => 'some url'
);
json_encode($item);
jQuery
$.ajax({
type: 'post',
url: ajaxurl,
data: {
action: 'a_grid_callback',
type: method
},
success: function(msg) {
console.debug(msg);
}
});
The debug returns this:
[{"title":"awesome title","permalink":"some url"}]0
If I was to do alert(msg.length) I would get a long number equivalent to the length of the code above.

Try to set
dataType: 'json'Looks like the browser is interpreting the response as a string.