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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:25:17+00:00 2026-05-21T10:25:17+00:00

I have a very simple form. So simple its scary. When I run the

  • 0

I have a very simple form. So simple its scary. When I run the form, it returns the data AND the message I require, however it opens another blank page to display the data. I have no idea how to return the query data from the php handler file to the success call back. I have tried appending it to the form. I usually do this in codeigniter and its not “all that” hard to do there.

the form and ajax

<form method="post" action="/checkipf.php" id="checkip">
<label>Enter the Address</label> &nbsp;&nbsp; <input type="text" size="30" maxlength="20" name="ip" id="ip" required /><br />

<input type="submit" value="Submit" name="submit" id="submit">&nbsp; &nbsp; &nbsp;   &nbsp; 
<div id="display"></div>

<script type="text/javascript">
$(function() {

$("#checkip").submit(function(){
var data = $('#checkip').serialize();

$ajax({
    url: "checkipf.php",
    type: "POST",
    data: data,
    success: function(msg) {                        
      $('#display').html(msg).show(1000);   // is this correct?         
      }
    }); 
    return false; 
});
});
</script>

The handling php file

$ip = mysql_real_escape_string($ip);
    if ($ip = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)){
    $sql = "SELECT `ip`, `total` FROM `spammer` where `ip` = '$ip'";
    $result = mysql_query($sql) or die(mysql_error());
    $count = mysql_num_rows($result);
    while ($row = mysql_fetch_array($result)) {
        $ip = $row['ip'];
        $total = $row['total'];
    }
    if ($count > 0) {
        echo "$ip has appeared $total times";

        } else {
            echo "$ip has not been seen";           
        }
    }else{
        echo "IP does not validate";
    }

As previously noted, the correct echo in the php file is returned on a blank page. I just cant get it to the success callback. If I run an alert the data shows it is being posted by ajax

Thanks for your time

  • 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-21T10:25:17+00:00Added an answer on May 21, 2026 at 10:25 am

    You missed a . in your function

    <script type="text/javascript">
    $(function() {
    
    $("#checkip").submit(function(){
    var data = $('#checkip').serialize();
    
    $.ajax({
        url: "checkipf.php",
        type: "POST",
        data: data,
        success: function(msg) {                        
          $('#display').html(msg).show(1000);   // is this correct?         
          }
        }); 
        return false; 
    });
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, so I have a very simple form with next to no logic in
I am posting a very simple form using a method I have used frequently
I have a very simple WPF application in which I am using data binding
i have very simple problem. I need to create model, that represent element of
I have very simple select like this: SELECT * FROM table WHERE column1 IN
I have a very simple problem which requires a very quick and simple solution
I have a very simple bit of script that changes the status of an
I have a very simple TCP server written in C. It runs indefinitely, waiting
I have a very simple Java RMI Server that looks like the following: import
I have a very simple ASP.Net page that acts as a front end for

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.