I have this code and I would like to modify it if possible to echo an image instead of the "is / not available" text. I'd also like to get rid of the button and use a onkeyup or something close to it so the user has real time notification. Can someone please help me to make these changes?
$(document).ready(function() {
$("#btnUsername").click(function() {
var name = $("#txtUsername").val();
var status = $("#divStatus");
status.html("Checking....").removeClass();
$.post("1.php", { username: name },
function(data) {
if (data == "true") {
status.html(name + " Is Available!").addClass("green");
} else {
status.html(name + " Is Not Available!").addClass("red");
}
});
});
});