EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: rahul.sanjose on November 27, 2012, 03:59:47 PM



Title: loading json from remote URL not working
Post by: rahul.sanjose on November 27, 2012, 03:59:47 PM
Hi,

I have a treegrid which is using the local json file. However, I made the data-options URL remote and the tree grid stopped working. I can see a call being made to remote data file and then a 200 ok response in firebug. However, the data is not displayed.

Before:
Code:
	<table id="tt" title="TreeGrid" class="easyui-treegrid" style="width:700px;height:300px"
data-options="url:'test.json',idField:'id',treeField:'code',

After(data not getting loaded from remote URL):
Code:
	<table id="tt" title="TreeGrid" class="easyui-treegrid" style="width:700px;height:300px"
data-options="url:'http://remote-host/test.json',idField:'id',treeField:'code',

Could someone please help?


Title: Re: loading json from remote URL not working
Post by: rahul.sanjose on November 27, 2012, 04:14:19 PM
Even I tried the following. Its not working either. :(

Code:
 $(document).ready(function(){ 
var mydata;
$.getJSON("http://remote-host/test.json", function(json) {
  mydata = json;
});
$('#tt').datagrid('loadData', mydata); alert('here');}
 )


Title: Re: loading json from remote URL not working
Post by: rahul.sanjose on November 27, 2012, 08:05:08 PM
I think I ran into the same origination policy issue. When I copied over the JS files to the remote-host, its working fine.

I read somewhere that getJson uses a different protocol. I am wondering if there is a work around for this issue that I just ran into.