PDA

View Full Version : Sencha json Ajax request fails to fetch response and shows "origin null is not alowd



khadarmeeran
12 Dec 2011, 9:59 AM
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 send
method: '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.responseText
alert(response.responseText) }});

mitchellsimoens
12 Dec 2011, 1:29 PM
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.

khadarmeeran
13 Dec 2011, 4:45 AM
thanks it helps me :)