Lab - Ajax
- Base it on the
demo
of JavaScript calling a server-side program in background.
- You will get this working on student.computing.dcu.ie
- Copy my HTML to a HTML file in your public_html.
- Copy my JS to a JS file in your public_html.
- The URL of your HTML file will be something like:
https://student.computing.dcu.ie/~userid/file.html
- Edit a new PHP file in your public_html.
This will be the server-side program it calls.
- The URL of your PHP program will be something like:
https://student.computing.dcu.ie/~userid/prog.php
- Change the JS from calling
my PHP program on my server
to calling your PHP program on student.computing.dcu.ie
- Note in the JS how you should remove the "http://server" part of the URL.
This is
Same origin policy.
(In fact, depending on browser, leaving "http://server" in may work, but only if same-origin.)
- Your PHP program does something with the argument.