Ajax and PHP problem not sending mail
I have a problem here, I have two files form.php and index.php , my form.php has an ajax to fetch data 开发者_如何学JAVAfrom index.php , also my index.php has a mail function which is running perfectly when we run index.php directly, but when i form.php to fetch data from index.php this mail function is not running ..... can any body tell me whats the problem why ajax does not make my index.php send mail ?????
Requesting index.php via AJAX does run the whole script, but in order to have the mail function work properly, your AJAX request must supply the script with the proper resources as if it were to be ran directly.
A PHP script called via AJAX should still be able to send an email.
What parameters are you using through index.php to generate the mail? Are they GET or POST variables? Does the AJAX call include those variables?
Have you run basic debugging in the index.php file? Just using file_put_contents( 'debug.txt' , 'Debug Data' , FILE_APPEND )
?
精彩评论