Side navigation
#6075 closed bug (worksforme)
Opened February 11, 2010 08:24PM UTC
Closed February 11, 2010 09:52PM UTC
Last modified February 12, 2010 11:03AM UTC
Bug in JSON response interpretation in ie6.
Reported by: | dchaplinsky | Owned by: | |
---|---|---|---|
Priority: | Milestone: | 1.4.2 | |
Component: | ajax | Version: | 1.4.1 |
Keywords: | ajax, ie6, json, dataType | Cc: | |
Blocked by: | Blocking: |
Description
Just found very strange bug which appeared, when we tried to migrated our site mydeco.com to jQuery 1.4.1.
One of ajax queries started to raising abnormal javascript error in ie6:
>Line: *72713225*
>Char: 9
>Error: Expected ','
>Code: 0
Where line is always has some inanely high random value
After some investigation I realized, that this is because ajax query was called without specifying exact dataType (json in my case) and IE6 raising error in globalEval procedure when executing
>head.insertBefore( script, head.firstChild );
jQuery 1.3.2 playing good here. Also, specifying dataType: "json" fixing the problem.
Here is the ajax request/response headers:
>http://mydeco/account/profile/slideshow/add/ajax/
>POST /account/profile/slideshow/add/ajax/ HTTP/1.1
>Host: mydeco
>User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6
>Accept: */*
>Accept-Language: en-us,en;q=0.5
>Accept-Encoding: gzip,deflate
>Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7
>Keep-Alive: 115
>Connection: keep-alive
>Content-Type: application/x-www-form-urlencoded; charset=UTF-8
>X-Requested-With: XMLHttpRequest
>Referer: http://mydeco/people/creator/edit-profile/
>Content-Length: 34
>Pragma: no-cache
>Cache-Control: no-cache
>content_type=room&object_id=595498
>HTTP/1.1 200 OK
>Date: Thu, 11 Feb 2010 20:13:53 GMT
>Server: WSGIServer/0.1 Python/2.5.4
>X-Debug-JSON: queries: 3, time: 0.001=(0.0002+0.0011+0.0002)
>Vary: X-HTTP-Force-Status-200
>X-Debug-Time: 4.058 ~= (0.002 + 4.054 + 0.002); I/O: 1.777; django: 2.280; delta=0.000;
>P3P: CP="CAO PSA OUR"
>Content-Type: application/x-javascript
>X-Debug-SQL: queries: 9, time: 1.776=(0.1650+0.3100+0.1570+0.1570+0.1600+0.1680+0.1600+0.1670+0.3320)
>Keep-Alive: timeout=5, max=100
>Connection: Keep-Alive
>Transfer-Encoding: chunked
Contact me, if you need any details or live demo.
Attachments (0)
Change History (2)
Changed February 11, 2010 09:52PM UTC by comment:1
resolution: | → worksforme |
---|---|
status: | new → closed |
Changed February 12, 2010 11:03AM UTC by comment:2
Hm, ok, but two things are worrying me:
1. Why it was ok in 1.3.2?
2. Can you enclose the statement with try/catch and maybe show appropriate message?
Because it's quite unclear to understand why it's producing strange errors on empty place.
That's correct - depending on the headers of your script it's likely that it's being interpreted as plain JavaScript. You can either fix the headers on your server-side script or just specify dataType: "json" (as you noted).