Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8266957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:21:06+00:00 2026-06-08T05:21:06+00:00

i am trying to send email using jquery and php. my html code is

  • 0

i am trying to send email using jquery and php.

my html code is

<form id="contactform">
            <table border="0" cellpadding="0" cellspacing="0" width="186">
              <tbody>
                <tr>
                  <td bgcolor="#2A677E" width="25">&nbsp;</td>
                  <td bgcolor="#2A677E" width="161">&nbsp;</td>
                </tr>
                <tr>
                  <td bgcolor="#2A677E">&nbsp;</td>
                  <td bgcolor="#2A677E"><img src="images/icon-email.jpg" alt="" align="left" height="17" hspace="2" width="27"><span class="text-white">Email this page</span></td>
                </tr>
                <tr>

                  <td bgcolor="#2A677E">&nbsp;</td>


                  <td bgcolor="#2A677E">
                      <input name="email"  onFocus="this.value=''" onMouseOver="window.status='Enter email address here and tell a friend about this site...'; return true" onMouseOut="window.status='';return true" size="22" type="text" class="button required email">
                      <table border="0" cellpadding="0" cellspacing="0" width="80%">
                        <tbody>
                          <tr>
                            <td align="right" height="30"><input class="button-dark"  onMouseOver="window.status='Click to send an email (with this page address) to a friend! Enter email address above...'; return true" onMouseOut="window.status='';return true" value="Send" type="submit">


                            </td>


<div class="saving" style="background-color:#D1F4DA;border:1px solid #017F1F;display:none;width:175px; font-size:12px; padding:5px;text-align:center; margin-left:-25px; margin-top:0px; position:absolute;"><img src="validate/ajax-loader.gif"/> Please Wait Processing Request </div>
                              <div class="success"  style="background-color:#D1F4DA;border:1px solid #017F1F;display:none;width:175px; font-size:12px;padding:5px;text-align:center; margin-left:-25px; margin-top:0px; position:absolute;"> <img src="validate/validYes.png"/> Message Sent.<br />
                                Thanks.</div>
                              <div class="nosuccess" style="background-color:#ffebe8;border:1px solid #dd3c10;display:none;width:175px; font-size:12px;padding:5px;text-align:center; margin-left:-25px; margin-top:0px; position:absolute;"> <img src="validate/failed.png"/> Error Sending Email. </div>                        


                          </tr>

                        </tbody>
                    </table>
                     </form>

i have following jquery code.

<script src="validate/jquery.js" type="text/javascript"></script>
<script id="demo" type="text/javascript">
$(document).ready(function() {
        var validator = $("#contactform").validate({
        submitHandler: function() {

      $('div.sending').fadeIn('slow');
        var a     = <?php echo $_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"]; ?>;
        var email     = $('#email').attr('value');

          $.ajax({
            type: "POST",
            url: "send_page_friend.php",
            data: "a="+ a +"&email="+ email,
            success: function(html){

                if (html==1){
                $('div.saving').hide();
                $('div.success').fadeIn();
                setTimeout(function() {
                $('div.success').fadeOut('slow');

                }, 3000);
                }

                if (html==2){
                $('div.saving').hide();
                $('div.nosuccess').fadeIn();
                setTimeout(function() {
                $('div.nosuccess').fadeOut('slow');

                }, 3000);
                }




                }
              });
        }

    });

});
</script>

but the error i am getting is, once i press the submit button i go same page with query string like /?email=....

its not calling that php Page and also not hiding div.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:21:08+00:00Added an answer on June 8, 2026 at 5:21 am

    You are defining a variable without the quotes. Should be something like that but could require some kind of more trustworthy escaping:

    var a     = '<?php echo $_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"]; ?>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to send email using PHP. The email is an HTML email
I am trying to send email using AJAX and PHP but no success:( My
I am trying to send email using c# following is my code. try {
I am trying to send an HTML email using Perl. open(MAIL,|/usr/sbin/sendmail -t); ## Mail
I am trying to send an email using the following very standard code. However,
I am trying to send email using mail() in php. I need the message
I'm trying to send an email from my application with a PHP contact form,
Well I'm trying to send a HTML email using gmail smtp from CI, and
I am trying to send email using apache james with this code public static
I am trying to send email using PHP mail. I get the following error:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.