RejectedSoftware Forums

Sign up

Firefox AJAX

I have some jQuery AJAX calls that work fine on Safari, Chrome, and Opera but doesn't seem to get through with Firefox. Has anyone run into this or is there some setting in Firefox that could be interfering?

function postRequest (req) {
    return $.ajax({
        type: 'POST',
        url: vibe + '/process_req',
        data: JSON.stringify(req),
        contentType: 'application/json',
        dataType: 'text'
    });
}

Re: Firefox AJAX

Am 10/14/2012 8:58 AM, schrieb Joshua Niehus:

I have some jQuery AJAX calls that work fine on Safari, Chrome, and
Opera but doesn't seem to get through with Firefox. Has anyone run into
this or is there some setting in Firefox that could be interfering?

Is the URL the same host/port as the website itself (maybe localhost vs.
127.0.0.1)? Or maybe the Firefox error console can give a clue.

I can only say that the forums use $.post(), which according to the
docs calls $.ajax(), and there it works fine in Firefox.

Re: Firefox AJAX

On Sun, 14 Oct 2012 10:11:53 +0200, Sönke Ludwig wrote:

Is the URL the same host/port as the website itself (maybe localhost vs.
127.0.0.1)? Or maybe the Firefox error console can give a clue.

I can only say that the forums use $.post(), which according to the
docs calls $.ajax(), and there it works fine in Firefox.

The host/port match up. But i did notice that i get the same error on the other browsers when I tack on "charset=UTF-8" to content-type which Firefox does automatically:

return $.ajax({
  type: 'POST',
  url: vibe + '/process_req',
  data: JSON.stringify(req),
  contentType: 'application/json; charset=UTF-8', // causes error
  //contentType: 'application/json',
  dataType: 'text'
});

Chrome produced the error below. Im still investigating, to see if i can get any more details/fix

Internal error information:
vibe.http.server.HttpStatusException@/Users/joshuaniehus/vibe/source/vibe/http/server.d(1040): Not Found

5 app 0x0000000109b45544 void vibe.http.server.handleHttpConnection(vibe.core.net.TcpConnection, vibe.http.server.HTTPServerListener) + 488
6 app 0x0000000109b426ca void vibe.http.server.listenHttpPlain(vibe.http.server.HttpServerSettings, void delegate(vibe.http.server.HttpServerRequest, vibe.http.server.HttpServerResponse)).void doListen(vibe.http.server.HttpServerSettings, vibe.http.server.HTTPServerListener, immutable(char)[]).void _lambda15(vibe.core.net.TcpConnection) + 54<br>7 app 0x0000000109b409b4 extern (C) nothrow void vibe.core.drivers.libevent2tcp.onConnect(int, short, void*).void ClientTask.execute() + 668
8 app 0x0000000109ae19b9 void vibe.core.core.CoreTask.run() + 129
9 app 0x0000000109ba09ed void core.thread.Fiber.run() + 49
10 app 0x0000000109ba0595 fiber_entryPoint + 97
11 ??? 0x0000000000000000 0x0 + 0

Re: Firefox AJAX

Am 10/19/2012 6:50 PM, schrieb Joshua Niehus:

On Sun, 14 Oct 2012 10:11:53 +0200, Sönke Ludwig wrote:

Is the URL the same host/port as the website itself (maybe localhost vs.
127.0.0.1)? Or maybe the Firefox error console can give a clue.

I can only say that the forums use $.post(), which according to the
docs calls $.ajax(), and there it works fine in Firefox.

The host/port match up. But i did notice that i get the same error on
the other browsers when I tack on "charset=UTF-8" to content-type which
Firefox does automatically:

Ah, I didn't fully realize that you send json, while I send a form...
The HTTP server erroneously checked for the content type to be exactly
"application/json", but the form detection was already correct and
separated the MIME type from charset etc.

A commit that supposedly fixes this has just been pushed to master (I
didn't actually test it yet).

Re: Firefox AJAX

On Fri, 19 Oct 2012 19:29:24 +0200, Sönke Ludwig wrote:

Am 10/19/2012 6:50 PM, schrieb Joshua Niehus:

On Sun, 14 Oct 2012 10:11:53 +0200, Sönke Ludwig wrote:

Is the URL the same host/port as the website itself (maybe localhost vs.
127.0.0.1)? Or maybe the Firefox error console can give a clue.

Ah, I didn't fully realize that you send json, while I send a form...
The HTTP server erroneously checked for the content type to be exactly
"application/json", but the form detection was already correct and
separated the MIME type from charset etc.

A commit that supposedly fixes this has just been pushed to master (I
didn't actually test it yet).

Oh cool, ill give it a try later tonight
Thanks

Re: Firefox AJAX

On Fri, 19 Oct 2012 19:46:56 +0200, Joshua Niehus wrote:

A commit that supposedly fixes this has just been pushed to master (I
didn't actually test it yet).

Oh cool, ill give it a try later tonight
Thanks

That did the trick, Firefox is up and running.

Thanks alot!