I am developing an app for my website using intel xdk and cordova plugin. Now how can I develop a login with a basic "Remember me" feature? It is possible to use a cookie? or any secure way to do it? Currently I am able to login using ajax request to the server(php). But how to include this feature. Any idea?
Added my login function
if($.trim(email).length>0 && $.trim(password).length>0) {
$.ajax({
type: "POST",
url: "http://www.example.com/app/login.php",
crossDomain: true,
dataType: 'json',
data: $.trim(frm.serialize()),
beforeSend: function(){
$('#loader').css({ display: "block" });
},
success: function(data,status,XHR) {
handleData(data);//handle the servers respond
},
error: function(httpReq,status,exception){
alert("Network error: "+status+" "+exception);
$('#loader').css({ display: "none" });
}
});
}
Then the handle data code is here:
function handleData( responseData ) {
var access = responseData;
if(access == "good"){//server respond good username/pass
alert("Welcome");
$('#loader').css({ display: "none" });
}
else{
alert("Your username and password didn\'t match.");
$('#input_password').val('');
$('#loader').css({ display: "none" });
}
console.log(responseData);
}
The server only respond "good" for the right username/password. And "bad" for the wrong credential login.