When I use jQuery ajax put at Internet Explorer 9, I am getting data at response body however it doesn't pass into success function. How can I make it work?
example:
...
    $.ajax({
        async : false,
        type: 'PUT',
        contentType: 'application/json',
        url: updateUrl,
        data: JSON.stringify(model),
        dataType: 'json',
        success: function(data) {
            console.log("Here!");//it comes here
            console.log(data);//it logs undefine at ie, firefox and etc is logging data
            r = resultResponse(data);
        },
        error: function(data) {
            try {
                r = error($.parseJSON(data.responseText));
            } catch (err) {
                //Handle error
            }
        }
    });
...
I debugged network and see that response body is:
{"message":"Connection is successful","status":"success"}
However data is undefined at success function at Internet explorer.
Any ideas?
PS 1: It is weird that when I send data from server without setting content type for response header it works?
PS 2: My response header as follows:
Key Value
Response    HTTP/1.1 200 OK
Server  Apache-Coyote/1.1
Content-Type    application/json;charset=UTF8
Transfer-Encoding   chunked
Date    Thu, 02 Aug 2012 15:50:44 GMT
As seen at output my charset was UTF8 instead of UTF-8. The problem was that at server side.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With