PDA

View Full Version : JSON Datastore works in Designer, not in Firefox



Britain Crooker
15 Aug 2010, 7:43 AM
I have created a Designer project that interfaces a Grid with a JSON data source created by PHP. It works fine in the designer: it shows how many records there are and the grid shows the data. If I look in the Apache access_log, it looks good as well:

255.255.255.255 - - [15/Aug/2010:11:37:34 -0400] "GET /data.php?_dc=1281886650498&query_type=material_list&material_type_id=6 HTTP/1.1" 200 3713 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.4 (KHTML, like Gecko) Ext Designer Safari/532.4"

Most importantly, note the "GET" part of the string. If I export this project and load the resulting files in Firefox (3.6.8) the grid remains empty. If I look at the access log, the new entry looks like this:

255.255.255.255 - - [15/Aug/2010:11:35:07 -0400] "OPTIONS /data.php?_dc=1281886506219&query_type=material_list&material_type_id=6 HTTP/1.1" 200 3713 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8"

The "GET" is now "OPTIONS".

Any ideas why?

Britain Crooker
15 Aug 2010, 7:46 AM
It does work in IE. Here is the entry for that:

255.255.255.255 - - [15/Aug/2010:11:44:31 -0400] "GET /data.php?_dc=1281887069968&query_type=material_list&material_type_id=6 HTTP/1.1" 200 3713 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MS-RTC LM 8; .NET4.0C)"

jarrednicholls
15 Aug 2010, 7:43 PM
Hi Britain,

In most modern browsers, cross-domain XHR requests are not allowed by default. Therefore the browser sends an OPTIONS request to see if their request from XYZ domain is acceptable to the destination domain. This is the behavior you are seeing. If you run the project files from within the same domain as the request is destined, you will see it working.

The Designer's embedded browser allows for cross-domain XHR requests, so that is why you see it working okay in the Designer.

Hope that helps!

Britain Crooker
19 Aug 2010, 5:07 PM
Thanks.