0

I have a list of events displayed in a div using php . These events are fetched from the database. But I need to display the events that are near the entered city.So I used the Google distance javascript api to find the distance between the entered city and city of each event. But Iam not able to load the needed events because the evenmts is in php and distance is in javascript .Can anyone help me to fetch the events that are near the entered city?

The main problem is that I have an array of events in php. To display the events nearest to the city, I have to calculate the distance in javascript and check if it is below some value and if yes,display it and then move to the next element in the array.So Can anyone help me?

0

1 Answer 1

2

Use an AJAX request to send the data to your php to fetch the results. You could also move the distance calculation to php.

Sign up to request clarification or add additional context in comments.

3 Comments

The problem with distance calculation in php is that there is a limit of 2500 requests per day.
I am displaying the list in the same page as the form.So I am submitting the form on clicking the search button. I need to check the distance of each event from the given city and display it if near the given city.How can I do that in ajax?
Then you need to reconsider your methods. Google might not be the answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.