I used Ajax call for display data and update data. Ajax call working well but it's not updating at single time. database updating well in server. For UI part it's not updating.
Used Ajax Call
$('#loginbutt').click(function(){
$.post('data.php',{action: "update"},function(res){
$('#result').html(res);
});
var servertime = $("#timer1").text();
var dataString = 'current_time='+ servertime;
$.ajax({
type: "POST",
url: "inset_intime.php",
data:dataString ,
cache: true,
beforeSend: function(html) {
document.getElementById("lastfive").innerHTML = '';
},
success: function(html){
$("#lastfive").append(html);
}
});
});
it's updating data .php but not updating inset_time.php. data is inserting well inti server. but UI not updating. IN data.php i given insert query for insert data. In inset_time.php i given select query for displaying data. but why it's not at a time when i click on loginbutt.
Try this
$(document).ready(function(){
$('#loginbutt').live('click',function(){
$.post('data.php',{action: "update"},function(res){
$('#result').html(res);
});
var servertime = $("#timer1").text();
var dataString = 'current_time='+ servertime;
$.ajax({
type: "POST",
url: "inset_intime.php",
data:dataString ,
cache: true,
beforeSend: function(html) {
document.getElementById("lastfive").innerHTML = '';
},
success: function(html){
$("#lastfive").append(html);
}
});
});
});