开发者

Best approach for confirmation page

I just finished the basic design structure for my contact page without flash; it's located here.

Can anyone suggest the best approach for making a confirmation script (inside a DIV) without reloading the page (preferably with jQuery). I want to replace the content in the main WRAP with new content (just text) confirming the email was received.

Any sugg开发者_JAVA百科estions?


First of all I don't believe you can notify the user that the mail was actually received (at least not in a trivial way). But you can notify that it was sent. For this with jQuery you can send the contact info via AJAX and then show the response in the DIV. May be something like this:

$.ajax({
   type: "POST",
   url: "sendMail.php",
   data: $('#contactForm').serialize(),
   success: function(msg){
     $("#responseDiv").html(msg).show();
   }

});

Of course this is assuming that your server sends the for with "sendForm.php" and that your contact form is wrapped with a <form> with "contactForm" as an id. The server should respond with the text to show within the div. If the message was sent or not.

Hope this helps.

References: Ajax help for jQuery

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜