无法使用jQuery查询JSON

I'm using jQuery to grab some JSON data. I've stored it in a variable called "ajaxResponse". I cant pull data points out of it; I'm getting ajaxResponse.blah is not defined. typeof is a string. Thought it should be an object.

  var getData = function (url) {
      var ajaxResponse = "";
      $.ajax({
        url: url,
        type: "post",
        async: false,
        success: function (data) {
                ajaxResponse = data;
        }
      });
      return ajaxResponse;
  },

...

typeof ajaxResponse; // string

ajaxResponse.blah[0].name // ajaxResponse.blah is not defined 

make sure you specify option dataType = json

  $.ajax({
    url: url,
    type: "post",
    dataType: "json",
    async: false,
    success: function (data) {
            ajaxResponse = data;
    }
  });

Q8-coder has the right of it, but to give you some details: your server is really passing back a string that you've formatted into JSON. You'll need to tell jQuery what to expect, otherwise it just assumes it received a string.

Add the following to your $.ajax options:

dataType: "json"

Also, refer to the jQuery API for examples and documentation for these options.