-
12 Dec 2011 9:59 AM #1
Sencha json Ajax request fails to fetch response and shows "origin null is not alowd
Sencha json Ajax request fails to fetch response and shows "origin null is not alowd
the following code fails to fetch the json response
& it shows the error ---XMLHttpRequest cannot load https://meme.hcl.com/services/json. Origin null is not allowed by Access-Control-Allow-Origin.
may i know the reason? pls reply....
-------------------------------------------------------
var con = new Ext.data.Connection();con.request({url:'https://meme.hcl.com/services/json', // where to do the request// jsonData: jsonData, // << key value object with data to sendmethod:'POST',callback: function(opts, success, response) {if (!success) {// Ext.MessageBox.alert("Error",//"Error retrieving data - try again");alert(response.responseText);return;}//use the answer of the request, which is contained in response.responseTextalert(response.responseText) }});
-
12 Dec 2011 1:29 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
If you are trying to load from a different domain than the one your app is on then you are restricted. You must use ScriptTag proxy or Ext.util.JsonP to get around the browser restrictions.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
13 Dec 2011 4:45 AM #3


Reply With Quote