Bug Tracker

Opened 8 years ago

Closed 8 years ago

#7644 closed bug (invalid)

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

Change History (2)

comment:1 Changed 8 years ago by Rick Waldron

Component: unfiledajax
Milestone: 1.next
Priority: undecidedlow
Type: enhancementbug

Not sure why this marked as an enhancement.

comment:2 Changed 8 years ago by Rick Waldron

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.

Note: See TracTickets for help on using tickets.