how can i login parse jquery ajax? - javascript

i can not see anything please help me.
How can i parse this code .
I can build cordova app .
i can parse everything app.js file but login doesnt work any ideas?
I think my js code wrong but where am i wrong ?
Cordova is new for me i have no experience for this
$('#submmit-register').on('click', function () {
console.log('login');
var username = $$('#register-username').val();
var email = $$('#register-email').val();
var password = $$('#register-password').val();
if (!username || !password || !email){
myApp.alert('Please fill in all Registration form fields');
return;
}
});
var query = 'http://-------/users/signup';
///'http://-------/users/login'
var postdata = {};
postdata.username = name;
postdata.email = email;
postdata.password = password;
myApp.showIndicator();
$.ajax({
url: query,
headers: {"X-Parse-Application-Id":applicationId,"X-Parse-REST-API-Key":restApiKey},
type: "POST",
contentType: "application/json",
data: JSON.stringify(postdata),
statusCode: {
201: success201,
400: notsuccess,
500: notsuccess
}
});
<div class="popup popup-login">
<div class="content-block-login">
<h4>LOGIN</h4>
<div class="loginform">
<form id="LoginForm" method="post">
<div class="form_row">
<div class="form_row_icon"><img src="images/icons/white/user.png" alt="" title="" /></div>
<input type="text" name="username" value="" class="form_input required" placeholder="username" />
</div>
<div class="form_row">
<div class="form_row_icon"><img src="images/icons/white/lock.png" alt="" title="" /></div>
<input type="password" name="password" value="" class="form_input required" placeholder="password" />
</div>
<div class="forgot_pass">
Forgot Password?</div>
<input type="submit" name="submit" class="form_submit" id="submit" value="LOGIN" />
</form>
<div class="signup_social">
<!--a href="http://www.facebook.com/" class="signup_facebook external">FACEBOOK</a>
<!--a href="http://www.twitter.com/" class="signup_twitter external">TWITTER</a->
LINKEDIN
<!--a href="http://www.twitter.com/" class="signup_googleplus external">GOOGLE+</a-->
</div>
<div class="signup_bottom">
<p>Don't have an account?</p>
LOGIN </div>
</div>
<div class="close_loginpopup_button"><img src="images/icons/white/menu_close.png" alt="" title="" /></div>
</div>
</div>
<!-- Register Popup -->
<div class="popup popup-signup">
<div class="content-block-login">
<h4>REGISTER</h4>
<div class="loginform">
<form id="RegisterForm" method="post">
<div class="form_row">
<div class="form_row_icon"><img src="images/icons/white/user.png" alt="" title="" /></div>
<input type="text" name="username" value="" class="form_input required" placeholder="username" />
</div>
<div class="form_row">
<div class="form_row_icon"><img src="images/icons/white/contact.png" alt="" title="" /></div>
<input type="text" name="email" value="" class="form_input required" placeholder="email" />
</div>
<div class="form_row">
<div class="form_row_icon"><img src="images/icons/white/lock.png" alt="" title="" /></div>
<input type="password" name="password" value="" class="form_input required" placeholder="password" />
</div>
<input type="submit" name="submit" class="form_submit" id="submit" value="REGISTER" />
</form>
<!--div class="signup_social">
FACEBOOK
<!--a href="http://www.twitter.com/" class="signup_twitter external">TWITTER</a->
LINKEDIN
<!--a href="http://www.twitter.com/" class="signup_googleplus external">GOOGLE+</a-->
</div-->
</div>
<div class="close_loginpopup_button"><img src="images/icons/white/menu_close.png" alt="" title="" /></div>
</div>
</div>
<!-- Login Popup -->
<div class="popup popup-forgot">
<div class="content-block-login">
<h4>FORGOT PASSWORD</h4>
<div class="loginform">
<form id="ForgotForm" method="post">
<div class="form_row">
<div class="form_row_icon"><img src="images/icons/white/contact.png" alt="" title="" /></div>
<input type="text" name="Email" value="" class="form_input required" placeholder="email" />
</div>
<input type="submit" name="submit" class="form_submit" id="submit" value="RESEND PASSWORD" />
</form>
<div class="signup_bottom">
<p>Check your email and follow the instructions to reset your password.</p>
</div>
</div>
<div class="close_loginpopup_button"><img src="images/icons/white/menu_close.png" alt="" title="" /></div>
</div>
</div>
<!-- Social Popup ->

First of all there is no submmit-register button or id found in your html code
You have used var username = $$('#register-username').val(); double dollar sign, which is not valid in javascript
I am not sure if what is myApp
myApp.showIndicator(); is a function then call it just like showIndicator();
myApp.alert is invalid
Replace this with success function to get result in just single function
statusCode: {
201: success201,
400: notsuccess,
500: notsuccess
}
success function
success: function(data){
console.log(data);
}

Related

The session is not working properly in PHP

The session is not working properly in PHP. The login page is working fine. But after redirecting to my home page I couldn't able to see my login details it throws this errorNotice : Undefined index: username in C:\xampp\htdocs\final\header.php on line
and if I use the if-else state to hide my login/signup button it's not working. So please someone help me with this issue
My Login page
<link rel="stylesheet" href="css/auth.css">
<body>
<div class="login-box"> <h2>Login</h2> <form action="handleLogin.php" method="post">
<div class="user-box">
<input type="text" name="loginEmail" required="">
<label>Email</label>
</div>
<div class="user-box">
<input type="password" name="loginPass" required="">
<label>Password</label>
</div>
<a href="#">
<span></span>
<span></span>
<span></span>
<span></span>
<input type="submit" value="LogIn" name="submit">
</a><br>
<a class="nav_btn" href="signup.php"><i class="icon_profile"></i>Create New Account</a> </form> </div>
</body> </html>
LoginHandle page
<div class="login-box"> <h2>Login</h2> <form action="handleLogin.php" method="post">
<div class="user-box">
<input type="text" name="loginEmail" required="">
<label>Email</label>
</div>
<div class="user-box">
<input type="password" name="loginPass" required="">
<label>Password</label>
</div>
<a href="#">
<span></span>
<span></span>
<span></span>
<span></span>
<input type="submit" value="LogIn" name="submit">
</a><br>
<a class="nav_btn" href="signup.php"><i class="icon_profile"></i>Create New Account</a> </form> </div>
</body> </html>
My header session
echo ' <form class="form-inline my-2 my-lg-0" >
<p class="text-light my-0 mx-2">Welcome'.$_SESSION["username"].' </p>
</form>';
I think you should use the post method for the form and then store the values in the sessions but remember to start session first
Here you logged in
<php?
// Check to see if we have some POST data, if we do process it
if ( isset($_POST['name']) && isset($_POST['pass']) ) {
$_SESSION["name"] = htmlentities($_POST["email"]);
header( 'Location: view.php' ) ;
return;
}
?>
<form action="handleLogin.php" method="post">
<div class="user-box">
<input type="text" name="loginEmail" required="">
<label>Email</label>
</div>
<div class="user-box">
<input type="password" pass="loginPass" required="">
<label>Password</label>
</div>
<input type="submit" value="LogIn" name="submit">
</form>

how to setup auto-close for popup in framework7 version1

i am using a framwork7 js version 1 for my android mobile app.but there is a problem in login popup, after the successful login the router is working, but the popup is still on the screen, it is not close.
index file popup code
<div class="popup popup-login">
<div class="content-block">
<h4>LOGIN</h4>
<div class="loginform">
<form id="LoginForm" method="post" class="close-panel">
<div id="msgprint" style="display: block;"></div>
<input type="text" name="Username" id="username" value="" class="form_input required" placeholder="Username" />
<input type="password" name="Password" id="password" value="" class="form_input required" placeholder="Password" />
<input type="button" name="submit" class="form_submit" id="submitlogin" onclick="loginHost()" value="SIGN IN" />
</form>
<div class="signup_bottom">
<p>Don't have an account?</p>
SIGN UP
</div>
</div>
<div class="close_popup_button">
<img src="images/icons/black/menu_close.png" alt="" title="" />
</div>
</div>
</div>
javascript for the router page
if(response.data.is_success){
mainView.router.loadPage({url:'user-product.html', ignoreCache:true,
reload:true });
}
if anyone knows the solutions. please answer.

Is this the right way to implement google recpatcha v3?

I've added the snippet inside the tag:
<script src='https://www.google.com/recaptcha/api.js?render=EXAMPLE123456789-_987654321'></script>
After that, I added this javascript callback inside each form on the site: (grecaptcha above the submit button).
<form accept-charset="UTF-8" target="_blank" action="https://website.infusionsoft.com/app/form/process/1234567890" class="infusion-form" id="inf_form_1234567890" method="POST">
<input name="inf_form_xid" type="hidden" value="1234567890" />
<input name="inf_form_name" type="hidden" value="First Last.com&#a;Web Form submitted&#a;HOME PAGE&#a;First / Last" />
<input name="infusionsoft_version" type="hidden" value="1.00.00.1" />
<div>
<div>
<p class ="white">Register Now</p>
</div>
</div>
<div>
<div> </div>
</div>
<div class="user-fields">
<div class="infusion-field">
<label for="inf_field_FirstName_home">First Name *</label>
<input class="infusion-field-input" id="inf_field_FirstName" name="inf_field_FirstName" placeholder="First Name *" type="text" required />
</div>
<div class="infusion-field">
<label for="inf_field_Email_home">Email *</label>
<input class="infusion-field-input" id="inf_field_Email" name="inf_field_Email" placeholder="Email *" type="text" required />
</div>
</div>
<div>
<div> </div>
</div>
<script>
grecaptcha.ready(function() {
grecaptcha.execute('EXAMPLE123456789-_987654321', {action: 'homepage'})
.then(function(token) {
// Verify the token on the server.
});
});
</script>
<div class="infusion-submit">
<button class="infusion-btn" type="submit">Submit!</button>
</div>
</form>
<script type="text/javascript" src="https://website.infusionsoft.com/app/webTracking/getTrackingCode"></script>
<script type="text/javascript" src="https://website.infusionsoft.com/app/timezone/timezoneInputJs?xid=12345678900987654321"></script>
Is this the correct way?

onClick Function can work only in loading Web Browser, and can't work totally after loading Web Browser

When I Click the Submit button with id 'submitPasscode', I want to hide the div tag (with id 'passcodeCard') and want to display the div tag (with id 'loginCard').
After Clicking it, onClick function 'checkPasscode()' is worked, but this function works only when loading web browser. It means that div tag (with id 'passcodeCard') didn't hide, and div tag (with id 'loginCard') didn't display after loading web browser.
I would like to know what is wrong with this code to work onClick Function works well.
Here is the code:
<div id="passcodeCard" class="loginDiv" style="margin-top: 10%;" style="display: inline;">
<form id="form" class="form-horizontal" style="padding-top: 5%;">
<div class="group">
<input type="text" id="passcode" name="passcode" placeholder="Enter Passcode"/>
<span class="bar"></span>
<label>Enter Passcode</label>
<button type="submit" class="button buttonBlue" style="margin-top: 5%;" id="submitPasscode" onclick="checkPasscode()">Submit</button>
</div>
</form>
</div>
<div id="loginCard" class="loginDiv widgetHeight" style="display: none;">
<img class="img-responsive user-logo" src="layouts/v7/resources/Images/hims5.png">
<div>
<span class="{if !$ERROR}hide{/if} failureMessage" id="validationMessage">{$MESSAGE}</span>
<span class="{if !$MAIL_STATUS}hide{/if} successMessage">{$MESSAGE}</span>
</div>
<div id="loginFormDiv">
<form class="form-horizontal" method="POST" action="index.php">
<input type="hidden" name="module" value="Users"/>
<input type="hidden" name="action" value="Login"/>
<div class="group">
<input id="username" type="text" name="username" placeholder="Username" value="admin">
<span class="bar"></span>
<label>Username</label>
</div>
<div class="group">
<input id="password" type="password" name="password" placeholder="Password" value="password">
<span class="bar"></span>
<label>Password</label>
</div>
<div class="group">
<button type="submit" class="button buttonBlue">Sign in</button><br>
<a class="forgotPasswordLink" style="color: #15c;">forgot password?</a>
</div>
</form>
</div>
</div>
<script>
function checkPasscode(){
if(document.getElementById("passcode").value == "passcode")
{
document.getElementById("form").style.display = "none";
document.getElementById("loginCard").style.display = "";
}
}
</script>
I don't completely understand your question, but is this what you wanted. I added some extra features such as making the fields required. Please let me know if this helped:
Here is the code:
<div id="passcodeCard" class="loginDiv" style="margin-top: 10%;" style="display: inline;">
<form id="form" class="form-horizontal" style="padding-top: 5%;">
<div class="group">
<input type="password" id="passcode" name="passcode" placeholder="Enter Passcode" required/>
<span class="bar"></span>
<label>Enter Passcode</label>
<button type="submit" class="button buttonBlue" style="margin-top: 5%;" id="submitPasscode" onclick="checkPasscode()">Submit</button>
</div>
</form>
</div>
<div id="loginCard" class="loginDiv widgetHeight" style="display: none;">
<img class="img-responsive user-logo" src="layouts/v7/resources/Images/hims5.png">
<div>
<span class="{if !$ERROR}hide{/if} failureMessage" id="validationMessage">{$MESSAGE}</span>
<span class="{if !$MAIL_STATUS}hide{/if} successMessage">{$MESSAGE}</span>
</div>
<div id="loginFormDiv">
<form class="form-horizontal" method="POST" action="index.php">
<input type="hidden" name="module" value="Users"/>
<input type="hidden" name="action" value="Login"/>
<div class="group">
<input id="username" type="text" name="username" placeholder="Username" value="admin" required>
<span class="bar"></span>
<label>Username</label>
</div>
<div class="group">
<input id="password" type="password" name="password" placeholder="Password" value="password" required>
<span class="bar"></span>
<label>Password</label>
</div>
<div class="group">
<button type="submit" class="button buttonBlue">Sign in</button><br>
<a class="forgotPasswordLink" style="color: #15c;">forgot password?</a>
</div>
</form>
</div>
</div>
<script>
function checkPasscode(){
if(document.getElementById("passcode").value == "passcode")
{
document.getElementById("form").innerHTML = "";
document.getElementById("loginCard").style.display = "block";
}
}
</script>

Mailchimp api using Jquery Ajax

I am having trouble getting the input to subscribe on submit and having it post to a Mailchimp subscription list.
I am using Jquery and Ajax as you can see in the code. I know my api endpoint is good because I tested it on Postman and was able to add a subscriber. However when I run my code locally it does not work.
I also tried to use the embedded code that mailchimp provides and when I would test, it would say that it is sending me an email to confirm addition to the subscribe list. But I never get an email to confirm and it never added to my subscription list. The code doesnt have https: in the links but I did have it in when I tested and did not work.
<!-- Begin MailChimp Signup Form -->
<link href="//cdn-images.mailchimp.com/embedcode/classic-10_7.css" rel="stylesheet" type="text/css">
<style type="text/css">
#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }
/* Add your own MailChimp form style overrides in your site stylesheet or in this style block.
We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
</style>
<div id="mc_embed_signup">
<form action="//bigbreakbjj.us14.list-manage.com/subscribe/post?u=06d10966e94997bd9b2564cb2&id=2eb203c03a" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<h2>Subscribe to our mailing list</h2>
<div class="indicates-required"><span class="asterisk">*</span> indicates required</div>
<div class="mc-field-group">
<label for="mce-EMAIL">Email Address <span class="asterisk">*</span>
</label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
</div>
<div class="mc-field-group">
<label for="mce-FNAME">First Name </label>
<input type="text" value="" name="FNAME" class="" id="mce-FNAME">
</div>
<div class="mc-field-group">
<label for="mce-LNAME">Last Name </label>
<input type="text" value="" name="LNAME" class="" id="mce-LNAME">
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_06d10966e94997bd9b2564cb2_2eb203c03a" tabindex="-1" value=""></div>
<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
</div>
</form>
</div>
<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script><script type='text/javascript'>(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';}(jQuery));var $mcj = jQuery.noConflict(true);</script>
<!--End mc_embed_signup-->
$("#new-person-form").on("submit", function(event) {
event.preventDefault();
$.ajax({
type: "POST",
url: "https://bigbreakbjj.us14.list-manage.com/subscribe/post?u=06d10966e94997bd9b2564cb2&id=2eb203c03a",
dataType: "jsonp",
data: {
"EMAIL": $("#email").val()
},
success: function(data) {
console.log(data);
alert("Subscribed!");
},
error: function() {
alert("Cannot subscribe");
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="col-sm-3">
<h4><strong>Sign Up Today</strong></h4>
<form id="new-person-form" action="https://bigbreakbjj.us14.list-manage.com/subscribe/post?u=06d10966e94997bd9b2564cb2&id=2eb203c03a">
<h6>First Name</h6>
<div>
<input type="text" id="first-name" />
</div>
<h6>Last Name</h6>
<div>
<input type="text" id="last-name" />
</div>
<h6>Phone Number</h6>
<div>
<input type="text" id="phoneNumber" />
</div>
<h6>Email</h6>
<div>
<input type="email" id="email" />
</div>
<div>
<button type="submit">Submit Form</button>
</div>
</form>
</div>

Categories

Resources