Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#7924 closed bug (worksforme)

JSON name collision when using jQuery.ajax()

Reported by: jhill9693@… Owned by:
Priority: undecided Milestone: 1.next
Component: ajax Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:

Description

Version: jQuery 1.4.2 Browser: Firefox 3.6.13 with Firebug 1.6.1 OS: Windows 7 Home Premium, x64

Steps to reproduce:

  1. Set up a server-side handler to send the following JSON data:
{"result":"success"}
  1. Perform a jQuery.ajax() call:
$.ajax({
    cache: false,
    type:  'POST',
    url:   'http://url-to-your-application',
    data:  {},
    dataType: 'json',
    error: function(e, xhr) {
        alert('error');
    }
    success: function(data, textStatus, XMLHttpRequest) {
        alert('success');
    }
});

Expected result:

An alert box with the word 'success'

Actual result:

An alert box with the word 'error'

Workaround:

The "result" property in the JSON object seems to be the problem. Changing it to "r" allows jQuery to parse the JSON correctly.

Change History (3)

comment:1 Changed 13 years ago by jitter

Component: unfiledajax
Resolution: invalid
Status: newclosed

Thanks for taking the time to contribute to the jQuery project by writing a bug report. As you didn't provide a live test case on http://jsfiddle.net I made one my self. live test case but I couldn't reproduce your problem.

Please report back if you can provide a reproducible test case and request the reopening of this ticket and we will happily investigate this issue further.


How to report bugs

Version 0, edited 13 years ago by jitter (next)

comment:2 Changed 13 years ago by jitter

Resolution: invalid
Status: closedreopened

comment:3 Changed 13 years ago by jitter

Resolution: worksforme
Status: reopenedclosed
Note: See TracTickets for help on using tickets.