Click here to Skip to main content
15,903,012 members

Comments by iDoKin (Top 66 by date)

iDoKin 20-Sep-16 4:40am View    
Update HTML page code.


<form id="goin" name="goin" class="goin" onclick="Goin()" >     <h3>Sign In</h3>     <input type="email" name="email" id="email" required="required" class="email" value="" Placeholder="Email Address" >     <input type="password" name="password" id="password" class="password" required="required" value="" placeholder="Password" >     <input type="submit" id="login" name="login" class="login" value="Login"><br/>    <div class="noaccount">           <b>No account?</b><a href="register.html">Sign Up>   </div></form>



I get the long string from server, but the string is displayed in a iframe page, so challenge is getting hold of that string so in my javascript where can I put the code to get that string split it and save it in localSession? M a newbie to phonegap still learning. Help will be appreciated.
iDoKin 20-Sep-16 4:36am View    
And my login javascript the updated code.

`function Goin() {

var form = $("#goin");

var url = 'https://www.test.login';
var email = $("#email").val();
var password = $("#password").val();
var loginPath = url + 'testlogin?' + email + '|' + password + '|';
if(email != "" && password != "") {
$.ajax({
type: 'POST',
url: loginPath,
crossDomain: true,
data: {email: email, password :password},
dataType: 'json',
async: false,
//if login success store session id in cookie
success: function (response){
console.log('response');
alert ("response");
if (response.success) {
alert("You're logged in");
console.log("You're logged in");
window.localStorage.setItem("sessionId", "value");
var sessionId = window.localStorage.getItem("sessionId");
window.location.replace("/index.html");
}
else {
alert("Your login failed");
console.log('Your login failed');
window.location("signin.html");
}
},
error: function(error){
//alert(response.success);
console.log('Could not connect to the server');
alert('Could not connect to the server' + error);
window.location = "signin.html";
}
});
}
else {
//if the email and password is empty
console.log('You must enter email and password')
alert("You must enter email and password");
}
return false;
}`
iDoKin 19-Sep-16 7:57am View    
This helped.
iDoKin 19-Sep-16 7:55am View    
Yes it is.
iDoKin 15-Sep-16 17:37pm View    
Okay. I m exploring on phonegap as while hey. M not jquery or javascript qurru. Just learning for fun and coding for the love of it.