Jump to content

help Ajax Login from external page


Recommended Posts

Hi I have the need to access PrestaShop from an external page . I tried using ajax but can not make the connection . Go back to the login page with the word entered . Can someone help me?

 

This is the code

<div id='login'>
<div class='block'>
             <p class='title_block' style='margin-bottom: 10px;'>Login</p>
             <div class='form_content clearfix'>
             <p class='text'>
             <label for='email'>Email address</label>
             <span><input type='text' id='email' name='email' value='' class='account_input' style='width: 192px;' /></span>
             </p>
             <p class='text'>
            <label for='passwd'>Password</label>
            <span><input type='password' id='passwd' name='passwd' value='' class='account_input' style='width: 192px;' /></span>
        </p>
        <p class='submit'>
            <input type='hidden' class='hidden' id='back' name='back' value='http://www.moovida.net/a.php?pagina=secondo_log' /> 
			<button type="submit" value="login" onclick="effettua_login();">Login</button>
        </p>
    </div>
  
</div>
<script> 
function effettua_login(){
var email = document.getElementById("email").value;
var passwd = document.getElementById("passwd").value;
var back = document.getElementById("back").value;
 $.ajax({
		  type: "POST",
		  url: "http://www.mysite.net/myshop/ajax.php?controller=authentication",
		  data: "email="+email+"&passwd="+passwd,
		}).done(function( messaggio ) {
		   $("div#login").html(messaggio);
		}).fail(function() { 
		   $("div#login").html("Attenzione ci sono problemi con il caricamentodei dei dati utente");
		});
}
</script>
</div>

Edited by Jurgs (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...