$(document).ready(function(){ $("#error").css('display', 'inline', 'important'); $("#error").html("
"); $("#login").click(function(){ username=$("#username").val(); password=$("#password").val(); $.ajax({ type: "POST", url: "zetatech-admin.php", data: "username="+username+"&password="+password+"&login=Login", success: function(response) { var answer = JSON.parse(response); if(answer.return == 'true') { $("#content").html(answer.string); } else { $("#error").html(answer.string); } }, beforeSend: function() { $("#error").html("Loading..."); }, error: function() { $("#error").html("Error"); } }); return false; }); });