title: JSON response field is undefined
body: <p>I followed the instructions here <a href="https://stackoverflow.com/questions/5371658/problem-performing-ajax-call-from-asp-net-mvc2-app">Problem performing Ajax call from ASP.NET MVC2 app</a>, and read about JSON. I searched a lot but didn't find an answer. I use the following code:</p>
  
  <p>view:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var userName = $("#userName").val();
  
  $.ajax({
      type: 'POST',
      url: '/Home/PgAJAXTest',
      data: {
          q: 'Test1',
          s: 'Test2'
      },
      success: function (bbb) {
          alert(bbb.Val13);
      },
      error: function (msg) {
          alert("error");
      }
  });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>ASP.NET MVC controller code is:</p>
  
  <pre><code>    [HttpPost]
      public JsonResult PgAJAXTest(string q, string s)
      {
          var a = Json(new { Val13 = " TEST " }); 
          return a;
      }
  </code></pre>
  
  <p>The problem is that I get <code>"undefined"</code>.<br>
  If I change <code>alert(bbb.Val13);</code> to <code>alert(bbb);</code> I get <code>{"Val13":" TEST "}</code></p>
  
  <p>I suppose it has something to do with the controller not returning the JSON exactly in the format that JSON expects.</p>