views:

72

answers:

1

I can get the return json string parse with $.post(), but not $.ajax().

{"result": "success", "id": "1"}
+5  A: 

Nothing the actual code for post is:

post: function( url, data, callback, type ) {
    // shift arguments if data argument was omited
    if ( jQuery.isFunction( data ) ) {
        type = type || callback;
        callback = data;
        data = {};
    }

    return jQuery.ajax({
        type: "POST",
        url: url,
        data: data,
        success: callback,
        dataType: type
    });
},

as the docs say, it is simply a shorthand for $.ajax