Bug Tracker

Modify

Ticket #6294 (closed bug: worksforme)

Opened 3 years ago

Last modified 3 years ago

jQuery1.4.2 ajax bug

Reported by: zhanghuihua Owned by:
Priority: undecided Milestone: 1.4.3
Component: ajax Version: 1.4.2
Keywords: jQuery1.4.2 Cc:
Blocking: Blocked by:

Description

jQuery.ajax({

type: "POST", url: url, data: data, success: callback, dataType: type

});

if dataType is "json", then connot call callback function. default dataType is OK.

Attachments

ajax-bug.zip Download (44.5 KB) - added by zhanghuihua 3 years ago.
jQuery 1.4.2 Ajax bug

Change History

comment:1 Changed 3 years ago by zhanghuihua

I just update jQuery RIA framework from jQuery1.3.2 to 1.4.2, connot call callback function.

Demo url:  http://dwz.duqn.com/

jQuery.ajax({

type:"POST", url:url, data:{}, success:callback, dataType:"json"

});

comment:2 Changed 3 years ago by dmethvin

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

I was unable to read the test page to see how to submit an ajax request. The most likely cause of a problem with json from 1.3 to 1.4 is that the site is not producing valid json:

VALID: {"test": "string"} INVALID: { test: "string"} INVALID: { 'test': "string"} INVALID: { "test"": 'string'}

Changed 3 years ago by zhanghuihua

jQuery 1.4.2 Ajax bug

comment:3 Changed 3 years ago by zhanghuihua

  • Status changed from closed to reopened
  • Resolution invalid deleted

jQuery.post( url, [ data ], [ success(data, textStatus, XMLHttpRequest) ], [ dataType ] )

Connot call success callback function, when dataType is "json" the jQuery version is 1.4.2.

Please download the attachment "ajax-bug.zip" and open "json-test.html" on IE or firefox.

comment:4 Changed 3 years ago by addyosmani

  • Priority set to undecided
  • Status changed from reopened to closed
  • Resolution set to worksforme

The problem with your original example is that you were attempting to parse/load malformed JSON structures using $.post. If you take a look at your original file (ajaxDone.html) you will see this.

I've uploaded a correctly formed JSON example here, being loaded by your original code, save for the output being different due to the change in JSON file.

 http://www.addyosmani.com/jquery/6294/json-test.html

As you can see in FireFox, this is working fine using jQuery 1.4.2.

Closing this ticket as it is not a bug.

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.