When you write javascript oData if you get an Access denied error. You have to change Web Addresses from Deployment Manager.
Open the Deployment Manager
First of all you must be a Dynamics CRM deployment admin to access the Dynamics CRM Deployment Manager and change the Dynamics CRM URLs. If you dont have access to privileges, you can tell your administrator.
Open the Properties
Change Web Addresses
You have to change all 4 CRM URLs to the full FQN CRM URL (Full Qualify Domain Name).
More info : http://www.dynamicscrmpros.com/microsoft-dynamics-crm-2011-access-denied-error-resolved/