jQuery/AJAX send autogenerated Email without form and stay on page
I know this is a widely covered subject, but I kept searching the Web and couldn't find a solution for my specific problem.
What I am trying to do with jQuery/AJAX (as mentioned in the title):
I DON'T want any sort of Form that the user can fill out.
I just want a button (some HTML-Element) that when clicked sends an automatically generated mail to a predefined addess.
Neither the content nor the subject or anything else needs to be "filled in" by the viewer/user.
There will only be one JS-variable (a client-side script will insert the right value) that should be put somewhere in the content of the Email. (see "myVar" in Code)
On clicking the button, the mail should be sent, the button should be replaced by a "Thanks whatever..."-message and that's IT! No redirecting to another page or whatnot.
What I have so far for the JS Part: (in PHP-File)
The sendEmail.php file:
For what it's worth: The Output (as shown in Sourcecode) seems to be correct with respect to syntax as well as Email adress etc.
I still very much lack experience and would be very grateful for a solution, or even for a nudge in the right direction!
If this problem has already been solved for someone on this site, I apologize. I didn't find it.
PS: If this is the wrong category, I apologize again. Please don't close/delete the thread, but just move it instead. :)
I think you might be "eating" the error on the php side. instead of complete try using success: and error: to handle errors n such.
take a look here for more info on error handling http://www.openlogic.com/wazi/bid/18...n-and-Handling
here goes the Output on the client side:
Will take a look at the error handling thing also, thanks for that!
side note, you should probably be checkign readystate too ie:
This is what it looks like now:
I have a feeling there's more to the error/success part, than I understand so far...
Any help would be greatly appreciated.
My sendEmail.php again:
|All times are GMT +1. The time now is 02:57 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.