Can any of you see why the div (#welcome) is not being updated in the below code?
function show_logged_in(success)
{
var is_logged_in = success;
var dataString = {"reg":invalid, "login":invalid,"is_logged_in":is_logged_in};
$.ajax({
type:"POST",
url:"PHP/class.ajax.php",
data:dataString,
dataType:'JSON',
success: function(username) {
alert("User is shown");
user = username;
change_div();
},
error: function() {
alert("ERROR in show_logged_in")
}
});
function change_div(){
$('#welcome').style.display = 'block';
$('#welcome').innerHTML = "Welcome" + user + "to SIK";
}
}
The response from the ajax called is simply grabbing the username from the session variable. and it is returning correctly.
And when it returns i would like the div to show up and say welcome. But for some reason the div is not being updated.
Here is the html:
<div id="welcome" style="display:none; postion:absolute; top:0; float:right;">...</div>