Jump to content

Portability


ryy705

Recommended Posts

Hello,

 

With PHP I've saved all my website settings in one file e.g

'baseUrl' => 'http://localhost/thisSite',
'resources' => '../Resources/',  
'templates' => '../Resources/TPL/',

 

This makes the site very portable. I simply make changes to this one file and

I can move the site to any server.

 

But I how can I do this with javascript and ajax?

right now I am embedding all the absolute urls in the ajax calls.

As the site grows it will become harder to move it around.

How would you guys solve this issue? Many thanks in advance.

Link to comment
Share on other sites

Have your functions accept json objects as arguments, you can then set sane defaults within each function or have them overridden. You could even have them overidden by a global json object but I think thats going a bit far.

 

Javascript is pretty notorious for this sort of thing (IMO), its hard to keep your code modular. You could take a look at the mootools framework. Its basic premise is to help modularize your code (amongst other things).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.