Advertisement
joris

BBUI - MyJS

Sep 6th, 2012
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function dataOnTheFly_initialLoad(element) {
  2.     setTimeout(loadAfterTimeout,1000);
  3. }
  4.  
  5. function LoadAjax(){
  6.     var GetData;
  7.     var serviceURL = "http://bertho.web.id/curl/services21/";
  8.  
  9.     $.ajax({
  10.                 type : 'GET',
  11.                 url : serviceURL + 'DataReadNP.php',
  12.                 async: true,
  13.                 beforeSend: function(x) {
  14.                     if(x && x.overrideMimeType) {
  15.                          x.overrideMimeType("application/j-son;charset=UTF-8");
  16.                     }
  17.                 },
  18.         dataType : 'json',
  19.         success : function(data){
  20.             GetData = data.items;
  21.             $.each(GetData, function(index, MyData) {
  22.             $('#dataList').append(
  23.                 '<li><a href="detail.html?id=' + MyData.id + '">' +
  24.                 '<h4>'+ MyData.judul +'</h4>' +
  25.                 '<p>' + MyData.web + '</p>' +
  26.                 '<p>' + MyData.desk + '</p>');
  27.             });
  28.             $('#dataList').listview('refresh');
  29.             },
  30.                 error : function(){
  31.                     alert('Your Connection Is Trouble')
  32.             }
  33.         });
  34. }
  35.  
  36. function loadAfterTimeout() {
  37.     document.getElementById('waiting').style.display = 'none';
  38.     LoadAjax()
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement