Skip to content

Instantly share code, notes, and snippets.

@boy3vil
Last active December 29, 2015 02:39
Show Gist options
  • Save boy3vil/7601709 to your computer and use it in GitHub Desktop.
Save boy3vil/7601709 to your computer and use it in GitHub Desktop.
$('.bagian_kiri ul li:nth-child(1)').click(function(){
ajax_load({ url: "ajax/cek.php", data: {}, location: $('.bagian_kiri div:nth-child(2)').find('div:nth-child(1)') });
});
$('.bagian_kiri ul li:nth-child(2)').click(function(){
ajax_load({ url: "ajax/cek.php", data: {}, location: $('.bagian_kiri div:nth-child(2)').find('div:nth-child(2)') });
});
});
function ajax_load(load){
//load.url
//load.data
//load.location
$.ajax({
type: 'POST',
url: load.url,
data: load.data,
async: true,
cache: false,
dataType: 'html',
beforeSend:function(){
$('.liad_image').show();
},
success: function (result) {
load.location.html(result);
$('.liad_image').hide();
},
error:function(){
alert('refres page');
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment