Recording JavaScript Event

I have written some JavaScript to automatically alert the user with a password when they click on the Facebook “Like” button on my web page.

The password is displayed via an AJAX call (to a PHP script) when the “Like” happens.

This brings up a security risk, because anyone can take the AJAX code on my web page, run it locally, and get the password without even doing the “Like.”

My question is, how should I program my AJAX call to know if the call actually came from the Facebook button event or whether it is user submitted manually?

Thanks in advance for your help.