tags:

views:

39

answers:

1

If I console.log(result); I get

{"MSG":"WRONG","QUESTIONID":182.0}

But If I console.log(result.QUESTIONID); I get

undefined

What am I doing wrong?

A: 

I needed to do this:

$.ajaxSetup({
    type: "POST"
    ,dataType: 'json'
    ,error: function(XMLHttpRequest, textStatus, errorThrown) {
        $('#msg').text(textStatus).addClass('err');
    }
});
cf_PhillipSenn
You don't *need* `$.ajaxSetup()`, but you can optionally use it. This sets defaults for *all* your ajax requests.
patrick dw
passing 'json' as the last argument in a query call would be quite enough.
naugtur