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 6346985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:07:21+00:00 2026-05-24T21:07:21+00:00

This is probably very simple, but I’m really in over my head. Basically, I

  • 0

This is probably very simple, but I’m really in over my head. Basically, I have a form with one input: email, and a submit button. This was not done by me so I understand very little of it. I tried to look up the .ajax jQuery command, but it still makes no sense.

Basically, here is what I have on the index.php.

The JS and HTML:

<!-- Subscription -->
<script>        
    $(function() {
        $('form input.submit').click(function (event) {
            event.preventDefault();
            event.returnValue = false;
            $.ajax({
                type: 'POST',
                url: 'subscribe.php',
                data: {email: $('form input[type=email]').val()},
                success: function(data) {
                    if (data == 'successful') {
                        $('#subscribe_status').html('Thanks for subscribing! We will let you know.').slideDown();
                    } else if (data == 'already_subscribed') {
                        $('#subscribe_status').html('This email is already subscribed.').slideDown();
                    } else if (data == 'invalid_email') {
                        $('#subscribe_status').html('This email is invalid.').slideDown();
                    } else {
                        $('#subscribe_status').html('Something went wrong. Please try again.').slideDown(); 
                    }
                },
                error: function () {
                    $('#subscribe_status').html('Subscription is not available.').slideDown();
                }
            });
        });
    });
</script>   
<form action="#">
    <input type="email" value="Your e-mail address..." onfocus="value=''" />
    <input type="submit" class="submit" value="Notify me" />
</form>

Subscribe.php

include 'go.php';
$email = $_POST['email'];
$ip=$_SERVER['REMOTE_ADDR'];
$timestamp = date("m/d/y H:i A");

mysql_query("INSERT INTO subscribers (ip, email, timestamp) VALUES (INET_ATON('$ip'), '$email', '$timestamp') ") or die(mysql_error());

I basically just keep getting “Something went wrong. Please try again.”

  • 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-05-24T21:07:22+00:00Added an answer on May 24, 2026 at 9:07 pm

    Subscribe.php doesn’t return anything, so data in your JS is always emtpy, hence the last else is always executed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably very simple but it's really confusing me. When I implement the
This one is probably very simple, but I can't seem to get it working.
Really having an issue debugging this...the reason why is probably very simple but I'm
Okay, this is probably very simple but, I have the below checks (not at
This is probably a very simple and stupid question to ask, but I have
This is probably very simple, but my attempts (guided by Intellisense and MSDN) have
This is probably a very simple question but I have a confusion about the
This is probably a very simple question, but at this time I have myself
I think this is probably a very simple but I can get my head
I know this is probably a very simple question but how would I do

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.