Skip to main content

Bug Tracker

Side navigation

#7644 closed bug (invalid)

Opened November 28, 2010 12:09AM UTC

Closed November 28, 2010 12:22AM UTC

DataType defination in Ajax calls

Reported by: fatihacet Owned by:
Priority: low Milestone:
Component: ajax Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:
Description

Hi jQuery Team,

First of all, I want to say, thanks all the team such as solid and impressive job. You should know that, you rock the world and changed the flowing of web development and see the world JavaScript is not an monster or evil. :-) So again thanks for that. As a Front End Web Developer, I really love to code with jQuery.

Then the matter is, when I make an ajax call to server I should always define dataType as lowercase, such as "json". For example check the following code please,

$.ajax({
    url: 'foo.php',
    type: 'GET',
    dataType: 'json',
    success: function(data){
        console.log(data.success)
    }
})

this works fine as expected. But if I accidently code dataType: 'JSON', it returns an error which says data.success is undefined.

Thanks..

Fatih ACET

Attachments (0)
Change History (2)

Changed November 28, 2010 12:15AM UTC by rwaldron comment:1

component: unfiledajax
milestone: 1.next
priority: undecidedlow
type: enhancementbug

Not sure why this marked as an enhancement.

Changed November 28, 2010 12:22AM UTC by rwaldron comment:2

resolution: → invalid
status: newclosed

This is not a jQuery bug. When you pass the wrong values, you will get unexpected results. The api docs list all the dataType's in lowercase - i would suggest sticking to that format.