No javascript work after coming back from an internal link
I have a main page which has an authentication control after loading as bellow
$(window).load(function() {
$.post('php/login_control.php',function(data) {
alert(data);
if (data =='notlogged') {
window.location = "logindialog.htm";
} else {
var greeting = "Hosgeldin " + data;
$("#allcontent").text(greeting);
}
});
});
after I give my password on the second page "logindialog.htm" and the authentication is completed as bellow
$('#loginok').click(function (){
var user_id_ = $('#userid').val();
var user_pass_ = $('#userpass').val();
$.post('php/login_do.php',{user_id:user_id_,
user_pass:user_pass_},function(data) {
if(data != 'OK') {
alert('wrong pass');
} else {
alert(data);
$.mobile.changePage( "index.htm", { transition: "slideup", changeHash: true, reloadPage: true, allowSamePageTransition: true});
};
});
});
it the password is correct it redirects me to the first page again. It works fine so far. The problem is, nothing works on the first page.. links, load function.. Only after I refresh from the browser it works. I also tried to put a refresh button, but the button itself also didn't work until I refreshed the whole page from the browser.
thank you