Fungsi Ajax Untuk Membuat Social Network ( Kayak Nge-Tweet Gitu )
function Buffering(){
$("#timeline").fadeIn(400).html('<div class=\'loading\'><img src=\'asset/images/loading/greyload.gif\' /></div>');
}
function Clear(){
$('#speak').val("");
}
function Speak(){
if ($('#speak').val()==""){
Alerterror();
}
else{
Buffering();
var speak = $('#speak').val();
var username = $('#username').val();
var PHPFile = 'controller/speak.php';
var elementTable = '#timeline';
var _aksi = 'Speak';
$.post(PHPFile,
{
'action' :_aksi,
'speak' : speak,
'username' : username
},function(data){
$(elementTable).html(data)
});
//Refresh();
Clear();
//Alertsucces();
}
}
function Refresh(){
Buffering();
var PHPFile = 'timeline.php';
var elementTable = '#timeline';
var _aksi = 'Refresh';
$.post(PHPFile,
{
'action' :_aksi
},function(data){
$(elementTable).html(data)
});
}
function AutoRefresh(){
var PHPFile = 'timeline.php';
var elementTable = '#timeline';
var _aksi = 'Refresh';
$.post(PHPFile,
{
'action' :_aksi
},function(data){
$(elementTable).html(data)
});
}
function AutoRefreshDelete(){
var PHPFile = 'timeline.php';
var elementTable = '#timeline';
var _aksi = 'Refresh';
$.post(PHPFile,
{
'action' :_aksi
},function(data){
$(elementTable).html(data)
});
AlertDelete();
}
function Confirm(_dc){
//alert(_dc);
var id_speak = _dc;
var PHPFile = 'controller/confirm.php';
var elementTable = '#timeline';
var _aksi = 'Confirm';
$.post(PHPFile,
{
'action' :_aksi,
'id_speak' : id_speak
},function(data){
$(elementTable).html(data)
});
}
function Delete(_dc){
//alert(_dc);
var id_speak = _dc;
var PHPFile = 'controller/deletespeak.php';
var elementTable = '#timeline';
var _aksi = 'Delete';
$.post(PHPFile,
{
'action' :_aksi,
'id_speak' : id_speak
},function(data){
$(elementTable).html(data)
});
Refresh();
}
$("#timeline").fadeIn(400).html('<div class=\'loading\'><img src=\'asset/images/loading/greyload.gif\' /></div>');
}
function Clear(){
$('#speak').val("");
}
function Speak(){
if ($('#speak').val()==""){
Alerterror();
}
else{
Buffering();
var speak = $('#speak').val();
var username = $('#username').val();
var PHPFile = 'controller/speak.php';
var elementTable = '#timeline';
var _aksi = 'Speak';
$.post(PHPFile,
{
'action' :_aksi,
'speak' : speak,
'username' : username
},function(data){
$(elementTable).html(data)
});
//Refresh();
Clear();
//Alertsucces();
}
}
function Refresh(){
Buffering();
var PHPFile = 'timeline.php';
var elementTable = '#timeline';
var _aksi = 'Refresh';
$.post(PHPFile,
{
'action' :_aksi
},function(data){
$(elementTable).html(data)
});
}
function AutoRefresh(){
var PHPFile = 'timeline.php';
var elementTable = '#timeline';
var _aksi = 'Refresh';
$.post(PHPFile,
{
'action' :_aksi
},function(data){
$(elementTable).html(data)
});
}
function AutoRefreshDelete(){
var PHPFile = 'timeline.php';
var elementTable = '#timeline';
var _aksi = 'Refresh';
$.post(PHPFile,
{
'action' :_aksi
},function(data){
$(elementTable).html(data)
});
AlertDelete();
}
function Confirm(_dc){
//alert(_dc);
var id_speak = _dc;
var PHPFile = 'controller/confirm.php';
var elementTable = '#timeline';
var _aksi = 'Confirm';
$.post(PHPFile,
{
'action' :_aksi,
'id_speak' : id_speak
},function(data){
$(elementTable).html(data)
});
}
function Delete(_dc){
//alert(_dc);
var id_speak = _dc;
var PHPFile = 'controller/deletespeak.php';
var elementTable = '#timeline';
var _aksi = 'Delete';
$.post(PHPFile,
{
'action' :_aksi,
'id_speak' : id_speak
},function(data){
$(elementTable).html(data)
});
Refresh();
}
0 comments: