ryy705 Posted October 26, 2009 Share Posted October 26, 2009 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. Quote Link to comment Share on other sites More sharing options...
trq Posted October 26, 2009 Share Posted October 26, 2009 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). Quote Link to comment Share on other sites More sharing options...
ryy705 Posted October 29, 2009 Author Share Posted October 29, 2009 Thank you for your reply. Do you propose that I create a json object for every every javascript page? Or are you saying that I should perhaps setup some sort of ajax functionality to retrieve the data from the server? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.