Order from help needed

by Mehwish84 1 replies
i had an order form in website. its a complicated one problem is before ordering on same form user can provide signup and login details. I only want when user puts login details he can verify whether details entered are correct or not using ajax.


My Javascript:


<script>
$(document).ready(function(){
$("#validate").click(function(){
email=$("#email").val();
password=$("#password").val();
$.ajax({url: "verify.php", success: function(result){
$("#mybox").html(result);
} });
});
});
</script>
want to run that on button


<button class="button button_middle button_arrow" id="validate" type="button"><span class="wrap">Validate Login<span class="icon"></span></span></button><div id="mybox"></div>


Please help???
#programming #form #needed #order
Avatar of Unregistered
  • Profile picture of the author PHR
    If I get you right,

    you want the jQuery code to be executed when clicking on the "Validate Login" button, right?

    If so, just put the jquery code into an JS function like:

    <script>
    function validateMe() {

    $(document).ready(function(){
    $("#validate").click(function(){
    email=$("#email").val();
    password=$("#password").val();
    $.ajax({url: "verify.php", success: function(result){
    $("#mybox").html(result);
    } });
    });
    });

    }
    </script>

    And then calling the function through the button like:

    <button class="button button_middle button_arrow" id="validate" type="button"><span class="wrap" onClick="validateMe()">

    If you have any other questions feel free to ask them.

    Cheers,
    Peter
    {{ DiscussionBoard.errors[10159041].message }}

Trending Topics