0

I added form in php with jquery validation.recently i added Remote technique for check email in registration.After the added it my form does not submit. What should i do ?

<script type="text/javascript">
runAllForms();
// Validation
$(function() {
    // Validation
    $("form_id_name").validate({

        // Rules for form validation
    rules : {
             email : {
                required : true,
                email : true,
                remote: 'page.php'   // page where i am checking email from database.
            }
        },

        // Messages for form validation
        messages : {
            email : {
                required : 'Please enter your email address',
                email : 'Please enter a VALID email address',
                remote: 'This email address is already taken! Try another.'
            }
        },

        // Ajax form submition
        submitHandler : function(form) {
            $(form).ajaxSubmit({
                success : function() {
                    $("from_id_name").addClass('submited');

                }
            });
        },

        // Do not change code below
        errorPlacement : function(error, element) {
            error.insertAfter(element.parent());
        }
    });

});

Page.php

<?php
include("connect_file.php"); // connection file
header('Content-type: application/json');
$email = $_REQUEST['email'];
$query=mysql_query("select email_col from table_name where email_col = '$email' ");
if (mysql_num_rows($query) == 0) {
    $output = 'true';
}
else {
    $output = 'false';
}
echo $output;
?>

What should i do ? I am begginer for jquery. please help me.

Bhavesh Patel
  • 115
  • 1
  • 2
  • 12
  • Where is `runAllForms` defined? – Regent Sep 11 '14 at 10:42
  • i added that page.php – Bhavesh Patel Sep 11 '14 at 10:54
  • What should you do? Do some basic troubleshooting so you can describe the problem to us better. What exactly happens? What is being shown in the console? Does `page.php` do what it's supposed to? The `remote` uses the `GET` method by default... in your PHP you're using `REQUEST`. See: http://stackoverflow.com/questions/1924939/php-request-vs-get-and-post – Sparky Sep 11 '14 at 14:37

0 Answers0