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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:50:30+00:00 2026-05-21T18:50:30+00:00

I am working on a page that displays all state parks. Something like this:

  • 0

I am working on a page that displays all state parks. Something like this:

http://www.comehike.com/outdoors/state.php?country_id=1&state_id=6&state_name=California&country_name=

I have the park data, including lat/lng in my database and I already get that data during the request. What I want to avoid is doing an AJAX call which will query the park data again.

Is it possible for me to just send the PHP result set to the JS somehow and to loop through the parks and display them?

I am already doing something like that by sending the map-center lat/lng so I figured it is doable with a result set.

Thanks,
Alex

  • 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-21T18:50:31+00:00Added an answer on May 21, 2026 at 6:50 pm

    This depends on how your pages are setup. If you’re using some kind of MVC setup, you need to pass the variable to your view first. Or if it’s a single page, just retrieve the PHP above and pass it as a variable.

    <?php
       $parkData   = $model->getData();  //make sure this returns an array or an object array or something
       $parkDataJson = json_encode($parkData);
    ?>
    
    //in your view
    
    <script type='text/javascript'>
       let parkData = <?php echo $parkDataJson ?>;
       //now you have a JSON array available for your use
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a page that displays several hundred images at once. I'm using
I have this web page I'm developing that displays multiple images of one product
I have a page which displays a different website (say www.cnn.com) in an iframe.
I'm working on a page that has three divs next to each other, each
I am working on .aspx page that uses a t-sql query that uses a
I'm working on a page that, when I load into IE8 and view the
I'm working on a page that has some ads on it. One of them
I am working on a page that someone long ago created. One of the
I'm currently working on a page that loads several images sequentially using setTimeout and
I am currently working on a page that has a date picker for one

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.