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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:32:27+00:00 2026-05-20T03:32:27+00:00

I am having some issues returning data from on page, using jQuery, PHP and

  • 0

I am having some issues returning data from on page, using jQuery, PHP and MySQL. I would like to show the query results on the index.php page. The results are fetched from the database using getResults.php.

When I manually run the getResults.php?id=123 file, all works fine. In this case i’m seeing the results I would like to. However, when I want to post the ‘id’ 123 in a submit form on index.php, I don’t see any results returned by jQuery / getResults.php. Only thing that changed is the URL: index.php?id=123. However, I’m not seeing any results or an error message…

Any one an idea?

getResults.php file

$search = mysql_real_escape_string( isset ($_POST['id']));

if ($search) {
$friend = mysql_query(  " SELECT * FROM reviews WHERE fbuserid = '$search' ORDER BY datumtijd DESC" );

if ( $friend )  {   
    while ($row = mysql_fetch_array ($friend) ) {
            echo "Show some results...";
    }
} else {
    echo "No matches found";
}
} else {
echo "Query not succesfull";
} 

index.php file

<script type="text/javascript" charset="utf-8">

        $(document).ready(function() {

        $("#submit").click(function) {
            event.preventDefault();
            $.ajax({
                url:"getResults.php",
                type:"GET",
                data: "id="+this.value,
                success: function(data) {
                    $("#results").html(data);
                }
            });
        }
        return false;
    });

    </script>    

    <div>
        <form>
            <input type="text" name="id">
            <input type="submit" value="submit" id="submit">
        </form>
    </div>        
    <div id="results"></div>

EDIT:
Thanks, all for your input. Nevertheless, I’m still not there… As you might notice, I’m not quite experienced with jQuery and PHP. See changes in scripts above. In short:
– I added the false statement if ($query) is not succesfull;
– Changed the $.post method into $.ajax;
– Changed the GET into POST in the PHP file;

Any other suggestions?

  • 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-20T03:32:28+00:00Added an answer on May 20, 2026 at 3:32 am

    You are POSTing data but your script is looking for it in GET.

    Edit in response to massive rewrite of the code in the question:

    • The first argument of $.ajax should be the URL.
    • You are missing the { from your settings object.
    • You are using a = instead of : for your type parameter.
    • You aren’t doing anything to stop the normal submission of the form, so the form gets submitted and a new page loaded before the HTTP request sent by the Ajax returns.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been having some issues with LINQ-To-SQL around memory usage. I'm using it
I am having some issues with using the OrderBy extension method on a LINQ
I am using Fluent NHibernate and having some issues getting a many to many
We are having some performance issues with a page and I wanted to ask
We've been having some issues with a SharePoint instance in a test environment. Thankfully
I'm having some issues with producing an int matrix without creating memory leaks. I
We are having some issues getting SharePoint to work as we want it to.
I'm having some inheritance issues as I've got a group of inter-related abstract classes
I'm having some weird issues with Xcode, and this is pretty much impossible to
I'm trying to experiment with xampp. After having some space issues, I wanted to

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.