As in the codec, it is impossible to prevent someone from creating their own Ajax request, which is identical to the one you have in your Javascript request. Cross-domain protection will not necessarily protect you there, as they can, if they wish, simply enter Javascript in the address bar for themselves, being on the page of your site.
The only protection you have is checking the input and parameters provided with an Ajax request on the server side. Limit every PHP or Python or any script response to a very specific task and check the server side input. If something is wrong, answer the error.
In short, there is no way to prevent someone from sending a request, but you can prevent them from doing something that you do not want to do on your server.
phsource Jun 04 '10 at 6:01 2010-06-04 06:01
source share