WorxWare.com Support Forum

Not logged in [Login - Register]
Go To Bottom
Printable Version  
Author: Subject: phpmailer-fe with AJAX
ligre
Junior Member
**




Posts: 2
Registered: 23-7-2009
Member Is Offline


[*] posted on 23-7-2009 at 08:09 AM
phpmailer-fe with AJAX


Hi,

I was using a very simple mailsend php file to do an AJAX submit with my form, but I would like to use phpmailer-fe.

That php just created some HTML table that was both sent as email and displayed in the #sucess div, using something like this

Code:
function showResponse() {
$('#contenido').hide();
$('#success').show('1500'); }


Will the redirect page be displayed in that region too? Will it work with an ajax submit?
I am not too familiar with AJAX and PHP but I have some idea, I would appreciate a not-to-techy response.
View user's profile View All Posts By User
andy.prevost
Super Administrator
*********




Posts: 185
Registered: 3-7-2009
Member Is Offline


[*] posted on 29-7-2009 at 11:07 PM


There is a feature in PHPMailer-FE for Flash forms that you can use in your Ajax scripting. You will have to create your own response messages in your script though.

To use it, open the config file for your form, and look for this line:

$_POST['flash_sent'] = 'sent=OK';

whatever you replace 'sent=OK' with is what will get transferred back to your script.

Andy
View user's profile View All Posts By User
littlerich
Junior Member
**




Posts: 2
Registered: 18-9-2009
Member Is Offline


[*] posted on 18-9-2009 at 02:32 PM


Hi there,

I'm trying to accomplish the same thing but am struggling to understand your instructions (sorry, but I'm a relative noobie!)

I have successfully installed PHPMailer-FE and it works great except that I'd like the success/failure messages to reload in the current page. I'm guessing it requires some Ajax expertise but I'm not yet a Jedi master!

I'd be really grateful if someone could give instructions on what I need to do. It's giving me sleepless nights!

Thanks,

Richard
View user's profile View All Posts By User
andy.prevost
Super Administrator
*********




Posts: 185
Registered: 3-7-2009
Member Is Offline


[*] posted on 18-9-2009 at 11:50 PM


Users of Flash forms, like Ajax, are expecting a return code from the processing of the form. In Flash, that is fixed ... they are looking for "sent=OK".

Set your Ajax listener to look for the same return, and that indicates the form processed properly and you can set your thank you message based on the return code.

Andy
View user's profile View All Posts By User
littlerich
Junior Member
**




Posts: 2
Registered: 18-9-2009
Member Is Offline


[*] posted on 19-9-2009 at 11:12 AM


Hi Andy,

Thank you for your quick response! I actually got it to work by using the jquery.form.js plugin () and the following code:

<script type="text/javascript">
$(document).ready(function() {
$('#myForm').ajaxForm({
target: '#message',

// success identifies the function to invoke when the server response
// has been received; here we apply a fade-in effect to the new content
success: function() {
$('#message').fadeIn('slow');
}
});
});
</script>

This sent all the PHPMailer responses (success or fail) to the div named #message, just as I wanted.

Thanks for your help anyway.

Richard


View user's profile View All Posts By User
andy.prevost
Super Administrator
*********




Posts: 185
Registered: 3-7-2009
Member Is Offline


[*] posted on 19-9-2009 at 09:33 PM


Thanks for letting me know.
Andy
View user's profile View All Posts By User
Nancie
Newbie
*




Posts: 1
Registered: 18-12-2009
Member Is Offline


[*] posted on 18-12-2009 at 03:09 AM


Thanks for this information..This is great..Cheers
View user's profile View All Posts By User
  Go To Top
Contents Copyright © 2004-2009, Worx International Inc. All Rights Reserved.
Powered by XMB – XMB Forum Software © 2001-2009 The XMB Group