This recipe shows you how to use an Ajax GET request and fetch data from a server. In this recipe, the server sends back soccer scores to a GET request from a Soccer League Scores form.
Copy the full code of this recipe from the
code/05/get-request sources folder. This code can be launched using the URL
http://localhost:8080/05/get-request/main.html. To try out this recipe you will need to launch the simple nodejs web server that is shipped along with the source code of this book. Launch the server by using the following command:
main.html, add the following code to create a form:
<div id='scores' data-role='fieldcontain'> <form id='scoreform' action='/getScores' method='get'> ...