Skip to main content

Bug Tracker

Side navigation

#10316 closed bug (invalid)

Opened September 20, 2011 10:13AM UTC

Closed September 20, 2011 12:59PM UTC

Last modified March 09, 2012 10:24PM UTC

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

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);
    },
});
Attachments (0)
Change History (2)

Changed September 20, 2011 12:59PM UTC by jaubourg comment:1

description: 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); \ }, \ });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); \ }, \ }); \ }}}
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.

Changed September 20, 2011 01:42PM UTC by praneeth.yerireddi@gmail.com comment:2

Thanks for the clear explanation.