Bug Tracker

Ticket #8267 (closed bug: worksforme)

Opened 4 years ago

Last modified 4 years ago

$.ajax, dataFilter broken

Reported by: anonymous Owned by:
Priority: low Milestone: 1.next
Component: ajax Version: 1.5
Keywords: Cc:
Blocking: Blocked by:

Description

jQuery ajax success method no longer receives any data when using the dataFilter method and returning sanitized data.

Change History

comment:1 Changed 4 years ago by jitter

  • Priority changed from undecided to low
  • Resolution set to worksforme
  • Status changed from new to closed
  • Component changed from unfiled to ajax

Thanks for taking the time to contribute to the jQuery project by writing a bug report.

As you didn't provide the test case (or any of the other data) requested in the  bug reporting guidelines, I went ahead and made this  test case which works for me.

Thus please report back with a reduced test case, that reproduces the issue you are experiencing, on  http://jsfiddle.net. So that we can reopen this ticket and investigate the issue further.

comment:2 Changed 4 years ago by vmx

I ran into the same issue, although it isn't a bug, it's not very clear either.

When the dataType is 'json' and your dataFilter returns JSON you will get 'null' back to your success function. When you return a string, it will be parsed and passed on to the success function.

So when you want to have the result of the dataFilter function passed on as is, then you need to set the dataType to 'text'.

Here are examples on jsFiddle:

comment:3 Changed 4 years ago by atodorov@…

I don't agree this is a low priority bug. This is a breaking change compared to the previous jQuery versions. when dataFilter is passed as string, and returns a parsed JSON object, it should just return it "as is", instead of returning null.

Angel

comment:4 Changed 4 years ago by dmethvin

See explanation in #9095.

Note: See TracTickets for help on using tickets.