Bug Tracker

Opened 10 years ago

Closed 9 years ago

#6294 closed bug (worksforme)

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:
Blocked by: Blocking:

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 (1)

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

Download all attachments as: .zip

Change History (5)

comment:1 Changed 10 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 10 years ago by dmethvin

Resolution: invalid
Status: newclosed

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 10 years ago by zhanghuihua

Attachment: ajax-bug.zip added

jQuery 1.4.2 Ajax bug

comment:3 Changed 10 years ago by zhanghuihua

Resolution: invalid
Status: closedreopened

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 9 years ago by addyosmani

Priority: undecided
Resolution: worksforme
Status: reopenedclosed

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.

Note: See TracTickets for help on using tickets.