Ajax, inherently, cannot make a call to another domain. When we need to grab remote data from another domain, we have to turn to some kind of helper to get the data.
This example requires either PHP or ColdFusion to be installed on our development machine. The example shows a call to 05_remote_data.php
. If we are using ColdFusion, please use the included snippet named 05_remote_data.cfm
instead.
The recipe is a continuation of what we are working on in the previous, local data request recipe. When we are familiar with those concepts, adding the remote call will be an easy stepping stone.
Interestingly, the client-side portion of this only changes in the URL variable. We call the server-side script instead of the static, local data page.
<script type="text/javascript" src="mootools-1.3.0.js"></script> </head> <body> <form action="javascript:" method="get"> <input type="button...