AJAX XMLHttpRequest issues
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?
The PHP file should just echo the variable required, and the AJAX call should have access to this in the responseText
.
精彩评论