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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:48:32+00:00 2026-06-03T14:48:32+00:00

I am creating a PHP site and have ran into the following problem, i

  • 0

I am creating a PHP site and have ran into the following problem, i would like to be able to click a hyperlink on a page, send a small data item to a php script, have the script perform its function and then return the results.

I am using AJAX with this site to have each page load into a div section of the site, all pages, data and responses load into this central div, like so:

<html>
    <body>
        <div id="topMenuBar">
            <div id="contents">
            //ALL DATA IS LOADED HERE...//
            </div>
        </div>
    </body>
</html>

So, when a page is selected from the top menu i simply have the following code run:

$('#topMenuBar a').click(function(e)
{
    e.preventDefault();
    $('#contents').load($(this).attr('href'), function()
    {
    });
});

Now that pages load into the content section, I am loading a page called “results.php” which connects to a DB, queries it, and the creates a HTML table with the results. Each table row has a small hyperlink which when clicked is intended to send a value to another PHP script and then clear the contents div and then repopulate the div with the response from this script (getInfo.php). For example, a row will have the following PHP code generate a link:

<label class="moreInfo"><a name="test01" onClick="getInfoFromPHP(<?php echo $data[$id]; ?> )">Get Info</a></label>

So when the table is generated by PHP it, the link when clicked passes a JS function the value.

What i now need to do is to send the value to a PHP script which will again query the DB, and have the results inserted into the “contents” div. I have been trying the following function.

function getInfoFromPHP(myVar){
    var netID = myVar;
    $.ajax({
        url: "getInfo.php",
        type: "POST",     
        data: { 
            networkID: netID
        }, 
        success: function(html) {
            $('#contents').empty();
            $('#contents').load(html);
        }      
    });
};

When i call the function it does seem to send the data to the script but i get the following error from firebug:

POST http://127.0.0.1/private/networks/includes/leave_a_network.php – 200 OK -15ms
GET http://127.0.0.1/%3Ch2%3EHello 403 Forbidden 21ms
“NetworkError: 403 Forbidden – http://127.0.0.1/%3Ch2%3EHello” Hello

The PHP script is only doing the following:

<?php
    session_start();
    $networkID = $_POST['networkID'];
    echo "<h2>Hello World</h2>";
?>

What is the best way to send data to a PHP script and have it load into a div?

Thanks for any feedback.

  • 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-03T14:48:34+00:00Added an answer on June 3, 2026 at 2:48 pm

    In the success function, put $(‘#contents’).html(html); instead of load.

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

Sidebar

Related Questions

I have a web-site based on PHP, to which I would like to add
I'm creating a new site for my project. I have made a index.php page
I am creating a very large PHP MVC-based site that will have a large
I am currently creating a site(php,css,html,ajax,MySql) which will have heavy user usage of space(regarding
I have a php site. For all of the page links I use foo.htm,
I have been looking into creating a signature on the OAuth site & over
I just created my very first PHP/MySQL site and was looking into creating a
I am creating site with php. On localhost all works well. On my hosting
I am creating my first site from scratch using PHP, MySQL, CSS, HTML, and
I going to be creating a membership site where you have to pay (PayPal)

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.