i want to create a web storage session login and print a successful page (welcome.html) with the
loggin session username and password.
Login form works but those not display the welcome user on the successful page. any help
below is the code
Code:$(document).ready(function(){ $("#rolling").slideDown('slow'); }); $(document).ready(function() { $("#submit").click(function() { if($("#uname").val()=="" || $("#pass").val()=="") { $("p").fadeTo('slow','0.99'); $("msg").hide(); $("p").fadeIn('slow',function(){$("p").html("<span id='error'>Please enter username and password</span>");}); return false; } else { $("p").html('<span class="normal"><img src="loading.gif"></span>'); var uname = $("#uname").val(); var pass = $("#pass").val(); $.getJSON("server.php",{username:uname,password:pass},function(json) { // Parse JSON data if json.response.error = 1 then login successfull if(json.response.error == "1") { //store session window.localStorage["uname"] = uname; window.localStorage["pass"] = pass; $.mobile.changePage("welcome.html"); } // Login failed else { data = "<span id='error'>Invalid account?</span>"; }
welcome.html
Code:<!DOCTYPE HTML> <html> <head> </head> <body> data = "<span id='msg'>Welcome "+uname+"</span>"; </body> </html>



Reply With Quote
Bookmarks