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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:17:16+00:00 2026-05-26T07:17:16+00:00

I have a map with numerous markers on it. I need help connecting my

  • 0

I have a map with numerous markers on it.

I need help connecting my Javascript with my PHP file so I can pull the relevant content from the database and put it inside the div of a popup window. The map and the popups work well, they open, but I just don’t know how to insert content from the database into the div #popupcontent.

Here is part of the JavaScript:

        function showPopup(id, leftbul, topbul){
            map.find(settings.popupSelector).fadeOut(); 
            var boxid = '#' + id + '-box';

            $(boxid).fadeIn();      
            $(settings.popupCloseSelector).click(function(){
            $(this).parent().fadeOut()              
            });
        }

The JavaScript/Ajax references a seperate HTML file where the popup markers are recorded. Each marker / popup has the following HTML, one after each other in the same file. In this instance the id references the land parcel identified as 97.

<a href="javascript:void(0)" id="97" class="bullet" style="color: rgb(0,0,0);font-size: 13px;" rel="222-156">97</a> 
<div class="popup" id="97-box" style="top:158px;left:220px;"> 
    <h3>97</h3> 
    <div class="popupcontent"> 
        <p>Insert my database content here </p> 
    </div>
    <a class="close" href="javascript:void(0)">Close</a> 
</div> 

I believe I need to insert something like this in the JavaScript, but I’m not getting it to work. Do you think you can help me here?

$.get("popup.php", (id),
function( data ) {
var content = $( data ).find( '#content' );
$( "#popupcontent" ).empty().append( content );
}

This is the server side PHP file:

<?php 
$id=$_GET["id"];
// Connects to your Database 
mysql_connect("mysql.url.com", "username", "password") or die(mysql_error()); 
mysql_select_db("database_name") or die(mysql_error()); 
$data = mysql_query("SELECT * FROM inventory WHERE lot_number = '".$id."'";) 
or die(mysql_error()); 
Print "<table border cellpadding=3 font-size:8px width:200px>"; 
while($info = mysql_fetch_array( $data )) 
{ 
Print "<tr>"; 
Print "<th>Lot number:</th> <td>".$info['lot_number'] . "</td></tr> "; 
Print "<th>Sales Status:</th> <td>".$info['lot_status'] . "</td> "; 
Print "<th>Model Built:</th> <td>".$info['model'] . "</td></tr> "; 
Print "<th>Lot Size:</th> <td>".$info['lot_size'] . " </td></tr>"; 
Print "<th>Frontage:</th> <td>".$info['lot_frontage'] . " </td></tr>";
Print "<th>Depth:</th> <td>".$info['lot_depth'] . " </td></tr>";
Print "<th>Premium:</th> <td>".$info['lot_premium'] . " </td></tr>";
Print "<th>Features:</th> <td>".$info['lot_features'] . " </td></tr>";
Print "<th>Restrictions:</th> <td>".$info['lot_restrictions'] . " </td></tr>";
Print "<th>Move-in Date:</th> <td>".$info['lot_move_date'] . " </td></tr>";
} 
Print "</table>"; 
?> 
  • 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-26T07:17:17+00:00Added an answer on May 26, 2026 at 7:17 am

    The easiest solution would be to use the .load method of jQuery.

    You will need to specify, e.g., a php file that will return html. Replace your $.get code with the following:

        $('.popupcontent').load('popup.php', {id: <your_id_here});
    

    One thing to note here: due to the fact that you are adding a parameters object here as the second parameter to .load, jQuery will use the POST method; therefore, in your php file, you need to change from $_GET to $_POST.

    If you want to keep using the GET method, then change the above code to the following:

        $('.popupcontent').load('popup.php?id=id1');
    

    I would recommend giving the popup content div an id, rather than class in this case. You are dealing with a unique item. I’m referring to your current HTML, you should change it to the following:

        <div class="popup" id="97-box" style="top:158px;left:220px;"> 
            <h3>97</h3> 
            <div id="popupcontent"> 
                <!-- RETURNED TABLE FROM PHP FILE WILL GO HERE --> 
            </div>
            <a class="close" href="javascript:void(0)">Close</a> 
        </div>
    

    If you are planning on having a number of popups that share this behavior, then what you can do is this instead:

        <-- HTML FILE -->
        <div class="popup" id="97-box" style="top:158px;left:220px;"> 
            <h3>97</h3> 
            <div class="popupcontent"> 
                <!-- RETURNED TABLE FROM PHP FILE WILL GO HERE --> 
            </div>
            <a class="close" href="javascript:void(0)">Close</a> 
        </div>
    
        // javascript file
        $('#97-box .popupcontent').load('popup.php', {id: <your_id_here>});
    

    The above pattern allows you to make popupcontent a generic class that can be used by other popups. The caveat is to add a different selector in your jQuery selector. In this case, I suggested $('#97-box .popupcontent') which will select the popupcontent div only under the html element with id: 97-box. In this case, that is your popup window.

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

Sidebar

Related Questions

I have .MAP file which is created from SAS XML mapper. As the name
I have map with multiple different colors markers with some info window. Everything works
I have a map with 4 layers, each layer having markers for various shops.
I have Map overlay showing filled circle. The issue I need this circle to
I have seen numerous examples of getting location name from Geocoder and then get
I have map.resources :posts and I want to be able to serve post bodies
I have a map declared as follows: map < string , list < string
I have to map a REST Webservice URL like http://server:8080/application/service/customer/v1 to createCustomer method in
I have a Map model, which defines the details for an ASCII-art map for
I have a map that represents a DB object. I want to get 'well

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.