Bug Tracker

Modify

Ticket #7644 (closed bug: invalid)

Opened 2 years ago

Last modified 2 years ago

DataType defination in Ajax calls

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

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

comment:1 Changed 2 years ago by rwaldron

  • Priority changed from undecided to low
  • Type changed from enhancement to bug
  • Component changed from unfiled to ajax
  • Milestone 1.next deleted

Not sure why this marked as an enhancement.

comment:2 Changed 2 years ago by rwaldron

  • Status changed from new to closed
  • Resolution set to invalid

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.