Question

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.

Was it helpful?

Solution

$("allemployees") should probably be $("#allemployees"), so it selects the html-element with the id allemployes.

OTHER TIPS

Found the solution...call to this function from "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);
}

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top