Advertisement
joris

My Sample jQuery

Sep 4th, 2012
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var GetData;
  2. var serviceURL = "http://my_server.com/";
  3.  
  4. function LoadAjax(){
  5.     $.ajax({
  6.                 type : 'GET',
  7.                 url : serviceURL + 'DataReadNP.php',
  8.                 async: true,
  9.                 beforeSend: function(x) {
  10.                     if(x && x.overrideMimeType) {
  11.                          x.overrideMimeType("application/j-son;charset=UTF-8");
  12.                     }
  13.                 },
  14.                 dataType : 'json',
  15.                 success : function(data){
  16.                     GetData = data.items;
  17.                     $.each(GetData, function(index, MyData) {
  18.                         $('#dataList').append(
  19.                         '<li><a href="detail.html?id=' + MyData.id + '">' +
  20.                         '<h4>'+ MyData.topic+'</h4>' +
  21.                         '<img src="'+MyData.img+'"/>' +
  22.                         '<p>' + MyData.detail+ '</p>' +
  23.                     });
  24.                         $('#dataList').listview('refresh');
  25.                 },
  26.                 error : function(){
  27.                     alert('Your Connection Is Trouble')
  28.             }
  29.         });
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement