Bug Tracker

Opened 10 years ago

Closed 10 years ago

#12783 closed bug (invalid)

using $.ajaxPrefilter with CORS request

Reported by: [email protected] Owned by: [email protected]
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:


Using $.ajaxPrefilter in Cross-origin resource sharing leads to 'parsererror'.

I'm using ajaxPrefilter to prepend server address to url before firing request. Request is send to proper url (as expected) but parser fails with textStatus 'parsererror' and errorThrown 'No conversion from json to domain.name/api/url (this is the full URL that is requested).

Here's how to reproduce:

$.ajaxPrefilter(function( options, originalOptions, jqXHR ){
  options.url = 'http://updates.html5rocks.com' + options.url;

  type: 'GET',
  url: '/2012/09/Live-Web-Audio-Input-Enabled',
  success: function() {
  error: function(jqXHR, textStatus, errorThrown) {
    console.log('textStatus: ' + textStatus);
    console.log('errorThrown: ' + errorThrown);

Change History (3)

comment:1 Changed 10 years ago by jaubourg

Could you provide a reduced test case for this? Not a jsfiddle since "Origin http://fiddle.jshell.net is not allowed by Access-Control-Allow-Origin.", but a simplified example on your server.

From what I can guess, you most probably set the dataType option of the request to "domain.name/api/url" somewhere. So there's something going on outside of this prefilter or the prefilter is more complex than what you put here.

comment:2 Changed 10 years ago by mikesherov

Owner: set to [email protected]
Status: newpending

comment:3 Changed 10 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.