开发者

AJAX request gives jQuery mysterious results in Firefox

开发者 https://www.devze.com 2023-02-22 15:44 出处:网络
I have a webapp written in rails and jQuery that\'s giving me a mysterious AJAX problem in Firefox. When I make a certain AJAX request against my localhost rails server, jQuery calls the request\'s e

I have a webapp written in rails and jQuery that's giving me a mysterious AJAX problem in Firefox.

When I make a certain AJAX request against my localhost rails server, jQuery calls the request's error event handler with no interesting error information, printing the arguments to the console reveals only:

[Object { readyState=0, status=0, statusText="error"}, "error", ""]

Interestingly, the server does receive the request and claims it responds successfully; certainly it does the server-side work it was supposed to. Neither HTTPScoop nor Wireshark have been able to give me any love in sniffing traffic on the loopback interface for some reason. Firebug doesn't report any response information, just an angry red X.

Even more interestingly, I get different behavior on heroku. In that case, the AJAX request still fails with no interesting error information given, firebug reports the angry red X, but the server never even receives the request.

It seems to be something with Firefox. Curl is able to POST the request successfully, and Safari and Chrome both run the application fine.

The problem isn't systemic. I have several other model objects that use the same pattern to save themselves to the server, and they work perfectly. Indeed, if the model is a different type: a line drawn freehand instead of segments, it works perfectly.

For what it's worth, the POST data of a failing request might be something like:

wall[kind]  wall
wall[vertex_values][0][x]   -60
wall[vertex_values][0][y]   -3
wall[vertex_values][1][x]   -55
wall[vertex_values][1][y]   2
wall[vertex_values][2][x]   -55
wall[vertex_values][2][y]   -1
wall[vertex_values][3][x]   -55
wall[vertex_values][3][y]   -4

wall%5Bkind%5D=wall&wall%5Bvertex_values%5D%5B0%5D%5Bx%5D=-60&wall%5Bvertex_values%5D%5B0%5D%5By%5D=-3&wall%5Bvertex_values%5D%5B1%5D%5Bx%5D=-55&wall%5Bvertex_values%5D%5B1%5D%5By%5D=2&wall%5Bvertex_values%5D%5B2%5D%5Bx%5D=-55&wall%5Bvertex_values%5D%5B2%5D%5By%5D=-1&wall%5Bvertex_values%5D%5B3%5D%5Bx%5D=-55&wall%5Bvertex_values%5D%5B3%5D%5By%5D=-4

While a successful request looks like:

wall[kind]  drawing
wall[vertex_values][0][x]   -50.0469798657718
wall[vertex_values][0][y]   1.0961968680089402
wall[vertex_values][1][x]   -49.77852348993288
wall[vertex_values][1][y]   0.9172259507829903
wall[vertex_values][2][x]   -49.51006711409395
wall[vertex_values][2][y]   0.7382550335570386
wall[vertex_values][3][x]   -49.331096196868
wall[vertex_values][3][y]   0.6487695749440636
wall[vertex_values][4][x]   -49.107382550335565
wall[vertex_values][4][y]   0.604026845637577
wall[vertex_values][5][x]   -48.92841163310961
wall[vertex_values][5][y]   0.5592841163310887
wall[vertex_values][6][x]   -48.838926174496635
wall[vertex_values][6][y]   0.5592841163310887
wall[vertex_values][7][x]   -48.749440715883665
wall[vertex_values][7][y]   0.5592841163310887

wall%5Bkind%5D=drawing&wall%5Bvertex_values%5D%5B0%5D%5Bx%5D=-50.0469798657718&wall%5Bvertex_values%5D%5B0%5D%5By%5D=1.0961968680089402&wall%5Bvertex_values%5D%5B1%5D%5Bx%5D=-49.77852348993288&wall%5Bvertex_values%5D%5B1%5D%5By%5开发者_StackOverflowD=0.9172259507829903&wall%5Bvertex_values%5D%5B2%5D%5Bx%5D=-49.51006711409395&wall%5Bvertex_values%5D%5B2%5D%5By%5D=0.7382550335570386&wall%5Bvertex_values%5D%5B3%5D%5Bx%5D=-49.331096196868&wall%5Bvertex_values%5D%5B3%5D%5By%5D=0.6487695749440636&wall%5Bvertex_values%5D%5B4%5D%5Bx%5D=-49.107382550335565&wall%5Bvertex_values%5D%5B4%5D%5By%5D=0.604026845637577&wall%5Bvertex_values%5D%5B5%5D%5Bx%5D=-48.92841163310961&wall%5Bvertex_values%5D%5B5%5D%5By%5D=0.5592841163310887&wall%5Bvertex_values%5D%5B6%5D%5Bx%5D=-48.838926174496635&wall%5Bvertex_values%5D%5B6%5D%5By%5D=0.5592841163310887&wall%5Bvertex_values%5D%5B7%5D%5Bx%5D=-48.749440715883665&wall%5Bvertex_values%5D%5B7%5D%5By%5D=0.5592841163310887

I'm completely perplexed. Have I hit the weirdest bug ever in Firefox, or am I doing something so stupid it's unfathomable to me?

0

精彩评论

暂无评论...
验证码 换一张
取 消