0

I'm using the geolocation API to get the user's co-ordinates, which I want to save as a variable in PHP and for argument's sake print on the same page (without refresh).

I'm using AJAX to send two JS variables from and index page to an external PHP page (which I haven't quite sorted yet but hopefully your answers will give me a better understanding of this).

In this PHP file, these two variables are inserted into the URL for an API which then prints out the town the user is in.

My question is: how do I echo this back to the original index page?

asked Jul 6, 2011 at 12:52

1 Answer 1

2

The PHP file should just echo the variable required, and the AJAX call should have access to this in the responseText.

answered Jul 6, 2011 at 12:54
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.