javascript - JQuery, Ajax submit with Mysqli validation -


how can submit form dynamically run mysqli check if email exists. if exists, echo error dynamically.

i run jquery ajax submit echo out php errors. can submit nothing echo.

function dynamic_check(x)     {                $.ajax(         {             url:'<?php echo htmlspecialchars($_server['php_self']); ?>',             type:'post',             data:x,         });     } 

x formdata. works, php echo not show nor vars created , echoed out throughout page errors.

if(isset($_post['register'])) {            $count = mysqli_num_rows(mysqli_query($con, "select * user email='$email'"));      if($count == 1) { $email_error='email exists'; } }  echo $email_error; 

is possible dynamically show $email_error?

you can use shorthand function jquery.post() sends serialized data of form , returns result variable.

$.post( "test.php", $( ).serialize(), function ( data ) {  ...what data (returns result of test.php)... }); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -