Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10316 closed bug (invalid)

Not able to use dataType:"text/html" in jquery 1.5.2

Reported by: praneethyr Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by jaubourg)

We were able to make successful ajax calls using $.ajax() with jquery 1.4.2 with dataType: "text/html".

But when we upgrade jquery to 1.5.2, the same code does not work unless the dataType is "html" . Please help.

Working good in jquery 1.4.2

$.ajax({
    type: "GET",
    timeout: 80000,
    url: "AjaxPage.html",
    dataType: "text/html",
    success: function(data) {
        var respData = $.trim(data)
        $("#ajaxResTempDiv").html(respData);
        $("#ajaxResMainDiv").html($("#ajaxResponse").html());
    },
    error: function(jqXHR, textStatus, errorThrown) {

        alert("jqXHR  :" + jqXHR);
        alert("textStatus  :" + textStatus);
        alert("errorThrown  :" + errorThrown);
    },
});

Works good in jquery 1.5.2

$.ajax({
    type: "GET",
    timeout: 80000,
    url: "AjaxPage.html",
    dataType: "html",
    success: function(data) {
        var respData = $.trim(data)
        $("#ajaxResTempDiv").html(respData);
        $("#ajaxResMainDiv").html($("#ajaxResponse").html());
    },
    error: function(jqXHR, textStatus, errorThrown) {

        alert("jqXHR  :" + jqXHR);
        alert("textStatus  :" + textStatus);
        alert("errorThrown  :" + errorThrown);
    },
});

Change History (2)

comment:1 Changed 12 years ago by jaubourg

Description: modified (diff)
Resolution: invalid
Status: newclosed

dataType "text/html" has never been valid. 1.4.x was more laxed in the sense it just considered any unknown dataType as plain "text" (or the dataType as determined by the response content type, I don't recall exactly right now). 1.5+ does not fall back to any default: if you give an unknown dataType, ajax will try and convert to this dataType and, failing finding a converter, will notify an error.

comment:2 Changed 12 years ago by praneeth.yerireddi@…

Thanks for the clear explanation.

Note: See TracTickets for help on using tickets.