0

im developing app by using intel xdk and i want to show JSON data coming form web page in my page.here is my code..

   function LoadJsonDataFunction()
{  
    $.getJSON("json_Data_webpage.php", function(obj) {
$.each(obj.employees, function(key, value){
$("allemployees").append("<li>"+value.fname+"</li>");
    });
 });
}

im calling above function in the body tag

 <body onload="LoadJsonDataFunction()">
 <ul id="allemployees"> </ul>

but this code is not working.

i have found jqm plugin for AppFramework.how can i use it to solve this.

4

2 回答 2

1

$("allemployees")应该是$("#allemployees"),所以它选择了 id 为 allemployes 的 html 元素。

于 2013-10-08T22:16:49.383 回答
0

找到解决方案...从“deviceIsReady”调用此函数

       <script>
/*Load remort data function*/


function loadRemortData(){
 document.addEventListener("intel.xdk.device.remote.data",function(event){
        if(event.success==false){
            $('#mytaskslist').append('<li data-divider-theme="a"><center><a  href="#win1" data-transition="pop" data-icon="alert">Error in connection</a></center></li>');
        } else {
            var obj = $.parseJSON(event.response);
            $.each(obj.employees, function(key, value){
                $('#mytaskslist').append(' <li><a href="#"><img src="images/b_add.png" />  <h3>'+value.sub+'</h3><p>'+value.des+'</p> <p>'+value.date+'</p> </a> </li>');
            });
            $('#mytaskslist').listview('refresh');
        }
    }, false); 

    var parameters = new intel.xdk.Device.RemoteDataParameters();
    parameters.url = "url_to_the_page.php";
    intel.xdk.device.getRemoteDataExt(parameters);
}

于 2013-11-19T05:33:30.133 回答