i have a jquery script:
$.get('php/username.php', { username: userName },
function(data){
var get_back = data;
alert(get_back);
});
what happes is that if i run it in firebug console it works, but if i add it inside a click function, it doesnt:
$(document).ready(function(){
$("#btnLogout").click(function () {
$.get('php/username.php', { username: userName },
function(data){
var get_back = data;
alert(get_back);
});
});
});
html
<p><input type="submit" name="btnLogout" id="btnLogout" value="Logout" class="page"/></p>
i don't understand.
thanks
$(document).ready();$(document).ready()submittobuttonunless you have compelling reason not to.