Is there anyway i can change this code to a ajax format?
$(document).ready(function(){
$("td[contenteditable=true]").blur(function(){
var msg = $(".alert");
var newvalue = $(this).text();
var field = $(this).attr("id");
$.post("update.php",field+"="+newvalue,function(d){
var data = jQuery.parseJSON(d);
msg.removeClass("hide");
if(data.status == 200){
msg.addClass("alert-success").removeClass("alert-danger");
}else{
msg.addClass("alert-danger").removeClass("alert-success");
}
msg.text(data.response);
setTimeout(function(){msg.addClass("hide");},1000);//It will add hide class after 3 seconds
});
});
});