Your canvas callback URL has to be an address that Facebook can actually fetch data from. That is not localhost
, since as the name implies that is local to you.
Read the following: http://wiki.developers.facebook.com/index.php/Canvas_Callback_URL#How_It_Works
Your canvas page URL is http://apps.facebook.com/foobar/
Your canvas callback URL is http://www.foobar.com/yourapp/
[...etc]
Putting localhost
as the canvas callback url is like buying something online and filling the shipping address as "my house".
For some basic information on how a Facebook application works, this is a good reading material:
http://wiki.developers.facebook.com/index.php/Anatomy_of_a_Facebook_App