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

  • SEARCH
  • Home
  • 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 8865549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:32:22+00:00 2026-06-14T16:32:22+00:00

i am trying for hours now, cant get it to work my ajax call

  • 0

i am trying for hours now, cant get it to work

my ajax call

 $('.button').click( function() {
         var mail = $("#mail_content").val();

         alert(mail);

        $.ajax({  
            type: "POST",  
            url: "process.php",  
            data: "mail="+ mail,  
            success: function(){  
                alert("success");  
            }  
        });
    });

my process.php

<?php
//  echo "<pre>";
//  print_r($_POST);
//  echo "</pre>";

include 'config.php';
include 'lib.php';

$db = dbConnect();


$mail = quote_smart($_POST['mail']);

//insert, update, select, delete
$query = "INSERT INTO mail VALUES ('', '$mail')";
$result = insertQuery($query);


 dbClose($db);

echo "entry saved";

?>

my form

<div class="email">
            <div class="email_title">GET NOTIFIED FOR THE GRAND OPENING<br /> </div>
            <div id="contact_form">
              <form id="mail" name="mail" action="" method="post" enctype="multipart/form-data">
                <fieldset>
                  <label for="mail" id="email_label">YOUR EMAIL</label>
                  <input type="text" name="mail_content" id="mail_content" size="30" value="" class="text-input" />
                  <input type="submit" name="submit" class="button" id="submit_btn" value="SAVE" />
                </fieldset>
              </form>
            </div>
        </div>

am i overlooking something?
it works when i put the process.php code in the action in the form

  • 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-14T16:32:23+00:00Added an answer on June 14, 2026 at 4:32 pm

    Just change your ajax call as below … This also solves submitting with enter issue.

     $('#mail').submit( function() {
            var mail = $("#mail_content").val();
            alert(mail);
            $.ajax({  
                type: "POST",  
                url: "process.php",  
                data: "mail="+ mail,  
                success: function(){  
                    alert("success");  
                }  
            });
            return false;
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to get this to work for a good few hours now,
I've been trying to get this code to work for a few hours now
I've been trying to get my program to work for several hours now and
I've been at the for hours now, trying to get vote_fu and running. I
I've been trying to get styling working on site uncookedblog.com for hours now. I
James here! I've been trying for about two hours now to get a sticky
I've been trying for a few hours now to get it working. So far
ive been trying to figure this out for 2 hours now and i cant
I've been trying to work out this problem for a good 48 hours now
I have been trying for too many hours now myself and can't get the

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.