Jump to content

jQuery functions and path


flydev
 Share

Recommended Posts

Hello,

I have a PHP script being called by AJAX request. At this moment everything work perfectly, but my script is in the root directory, bootstraping PW.

request = $.post('/public_html/pw/contactus.php', serializedData);

My question is, it is possible to put this PHP script in my templates directory and call it from there ? (if I hardcode the path I get a 403 HTTP error and doing that can cause problem between dev environment and production); 

How I should  code my path in the Javascript code ?

Link to comment
Share on other sites

I usually put 'variables' in an javascript object and put it in the site as one of the first scripts. There I define the variable I need, such as page locations etc.

In http://www.copal-development.com for example, the first script tag in de bottom of the page contains an config object. Every script after this script can read that object and thus read the variables.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...