List Info

Thread: DataTable with JSON data coming from server




DataTable with JSON data coming from server
country flaguser name
United States
2008-07-09 11:20:57

Hi,

I am new to javascript and YUI. To develop my application, I need to
to fetch data from remote server and shown in the browser. The
incoming data are JSON data. I have one server in my laptop which is
generating data and I want to fetch the data from there and shown in
my browser for the test reason. When ever I try to run my html file, I
can see the DataTable with column name in the browser but now data
rather it shows 'Loading Data...' but it never loads. I get the
following message in firebug 'Access to restricted URI denied" code:
"1012' If any one can help me in solving my problem then I will really
appreciate it. I have pasted the whole code below:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN&quot;
&quot;http://www.w3.org/TR/html4/strict.dtd&quot;>
&lt;html>
<head>
&lt;meta http-equiv="Content-Type&quot; content=&quot;text/html;
charset=iso-8859-1" />
<title&gt;Untitled Document&lt;/title>;

<!--CSS file (default YUI Sam Skin) -->
<link type=";text/css&quot; rel="stylesheet&quot;
href="http://yui.yahooapis.com/2.5.2/build/datatable/assets/skins/sam/datatable.css&quot;>


<!-- Dependencies -->
<script type=";text/javascript";
src=&quot;http://yui.yahooapis.com/2.5.2/build/yahoo-dom-event/yahoo-dom-event.js"></script>

<script type=";text/javascript";
src=&quot;http://yui.yahooapis.com/2.5.2/build/element/element-beta-min.js"&gt;</script>

<script type=";text/javascript";
src=&quot;http://yui.yahooapis.com/2.5.2/build/datasource/datasource-beta-min.js">&lt;/script&gt;


<!-- OPTIONAL: JSON Utility -->
<script type=";text/javascript";
src=&quot;http://yui.yahooapis.com/2.5.2/build/json/json-min.js"&gt;</script>

<!-- OPTIONAL: Connection (enables XHR) -->
<script type=";text/javascript";
src=&quot;http://yui.yahooapis.com/2.5.2/build/connection/connection-min.js"></script>


<!-- OPTIONAL: Drag Drop (enables resizeable or reorderable columns)
-->
<script type=";text/javascript";
src=&quot;http://yui.yahooapis.com/2.5.2/build/dragdrop/dragdrop-min.js"></script>


<!-- OPTIONAL: Calendar (enables calendar editors) -->
<script type=";text/javascript";
src=&quot;http://yui.yahooapis.com/2.5.2/build/calendar/calendar-min.js"></script>


<!-- Source files -->
<script type=";text/javascript";
src=&quot;http://yui.yahooapis.com/2.5.2/build/datatable/datatable-beta-min.js&quot;><;/script>;


<script&gt;

function showProcessList(){



var myColumnDefs = [
{key:";name",sortable:true, label:&quot;Name";},
{key:";values&quot;,sortable:true, label:&quot;Values&quot;},

];

var myDataSource= new
YAHOO.util.DataSource(&quot;http://localhost:8080/api-javascript/instance?ontology=EXECUTION-HISTORY&instance=http%3A%2F%2Fwww.ip-super.org%2Fontologies%2Fexecution-history%23event33f8ea90b9c3?&quot;);

myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
myDataSource.connXhrMode = "queueRequests&quot;;
myDataSource.responseSchema = {
resultsList : 'slots',
fields: ["name",&quot;values&quot;]
};


var myDataTable = new YAHOO.widget.DataTable("myContainer&quot;,
myColumnDefs, myDataSource);

}


</script>
</head&gt;
<body class=&quot;yui-skin-sam" onload=&quot;showProcessList()&quot;>
<div id="myContainer&quot;>&lt;/div>
</body>
&lt;/html>

__._,_.___
.

__,_._,___
Re: DataTable with JSON data coming from server
country flaguser name
Spain
2008-07-09 11:35:39

Probably you are facing the 'same-origin policy' (it's even in
Wikipedia: http://en.wikipedia.org/wiki/Same_origin_policy), you can't
read data from a server in a different domain than that which served the
HTML page. If it just a test setup, move things around. If the
production environment is going to be like that, you might want to take
a look at YUI's get utility.

Satyam

info2hussain wrote:
&gt; Hi,
>
> I am new to javascript and YUI. To develop my application, I need to
> to fetch data from remote server and shown in the browser. The
> incoming data are JSON data. I have one server in my laptop which is
> generating data and I want to fetch the data from there and shown in
> my browser for the test reason. When ever I try to run my html file, I
> can see the DataTable with column name in the browser but now data
>; rather it shows 'Loading Data...' but it never loads. I get the
> following message in firebug 'Access to restricted URI denied&quot; code:
&gt; "1012' If any one can help me in solving my problem then I will really
&gt; appreciate it. I have pasted the whole code below:
&gt;
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN&quot;
> "http://www.w3.org/TR/html4/strict.dtd&quot;>
&gt; <html&gt;
> <head&gt;
> <meta http-equiv="Content-Type&quot; content=&quot;text/html;
> charset=iso-8859-1&quot; />
&gt; <title>Untitled Document&lt;/title>;
>
> <!--CSS file (default YUI Sam Skin) -->
> <link type=";text/css&quot; rel="stylesheet&quot;
>; href=";http://yui.yahooapis.com/2.5.2/build/datatable/assets/skins/sam/datatable.css&quot;>
&gt;
>
> <!-- Dependencies -->
> <script type=";text/javascript";
> src="http://yui.yahooapis.com/2.5.2/build/yahoo-dom-event/yahoo-dom-event.js"></script>
>
> <script type=";text/javascript";
> src="http://yui.yahooapis.com/2.5.2/build/element/element-beta-min.js"&gt;</script>
&gt;
> <script type=";text/javascript";
> src="http://yui.yahooapis.com/2.5.2/build/datasource/datasource-beta-min.js">&lt;/script&gt;
>
>
> <!-- OPTIONAL: JSON Utility -->
> <script type=";text/javascript";
> src="http://yui.yahooapis.com/2.5.2/build/json/json-min.js"&gt;</script>
>
> <!-- OPTIONAL: Connection (enables XHR) -->
> <script type=";text/javascript";
> src="http://yui.yahooapis.com/2.5.2/build/connection/connection-min.js"></script>
>
>
> <!-- OPTIONAL: Drag Drop (enables resizeable or reorderable columns)
> -->
> <script type=";text/javascript";
> src="http://yui.yahooapis.com/2.5.2/build/dragdrop/dragdrop-min.js"></script>
>
>
> <!-- OPTIONAL: Calendar (enables calendar editors) -->
> <script type=";text/javascript";
> src="http://yui.yahooapis.com/2.5.2/build/calendar/calendar-min.js"></script>
>
>
> <!-- Source files -->
> <script type=";text/javascript";
> src="http://yui.yahooapis.com/2.5.2/build/datatable/datatable-beta-min.js&quot;><;/script>;
>
>
> <script>
>
> function showProcessList(){
>
>;
>;
>; var myColumnDefs = [
> {key:";name",sortable:true, label:&quot;Name";},
> {key:";values&quot;,sortable:true, label:&quot;Values&quot;},
&gt;
&gt; ];
>
>; var myDataSource= new
> YAHOO.util.DataSource("http://localhost:8080/api-javascript/instance?ontology=EXECUTION-HISTORY&instance=http%3A%2F%2Fwww.ip-super.org%2Fontologies%2Fexecution-history%23event33f8ea90b9c3?&quot;);
>;
>; myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
> myDataSource.connXhrMode = "queueRequests&quot;;
&gt; myDataSource.responseSchema = {
> resultsList : 'slots',
> fields: ["name",&quot;values&quot;]
> };
>
>;
>; var myDataTable = new YAHOO.widget.DataTable("myContainer&quot;,
&gt; myColumnDefs, myDataSource);
>
>; }
>
>
> </script>
>; </head>
> <body class=&quot;yui-skin-sam" onload=&quot;showProcessList()&quot;>
> <div id="myContainer&quot;>&lt;/div>
> </body>
> </html&gt;
>
>
&gt;
> ------------------------------------
&gt;
> Yahoo! Groups Links
&gt;
>
>
>;
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.138 / Virus Database: 270.4.6/1540 - Release Date: 08/07/2008 6:33
>;
>
>
>

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )