title: why is a javascript string shown as undefined in alert?
body: <p>the problem is that the <code>console.log('res', res)</code> shows that res.message is a valid string (IMO) but when shown in an alert, it shows <code>undefined</code>. I also tried using <code>typeof res.message</code> and it also returns <code>undefined</code>.. why is that?</p>
  
  <p>this is my code:</p>
  
  <pre><code>var myData = $('#myform').serializeArray();
  
  $.ajax({
    url: '/test/test1',
    type: 'POST',
    data: myData,
    success: function(res) {
      if (res.status) {
        window.location.reload();
      } else {
        console.log('failed', res);
        // the content of res is like so:
        // {"status":"1", "message":"approval for \"Nominations\" was successful."}
        alert(res.message);
      }
    },
    error: function(err) {
      console.log('error', err.responseText);
    }
  });
  </code></pre>