简体   繁体   中英

$.post() doesnt call php

I have a simple form with message and email input. After i validate email i send data through jquery.post() like this:

if (validateEmail(mail)) {

                var data = $('#kontakt').serialize();
                alert(data);
                  $.post('mail.php', data);

        }

And mail.php like this:

<?php

    echo "Mail: ". $_POST['mail'];
?>

I tried header in php and it wont even redirect... What am i doing wrong?

Make sure that the path to mail.php is correct.

Relative/Absolute path can sometime be tricky.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM