I am a Java developer who is working more and more with javascript. I love Jquery, but am unsure how to architect a largish ajax project.
Each widget I make will need to communicate with the server, so I have put each widget in its own directory and have it pull dynamic content from files in the same directory.
When I want a page (in another directory) to include the widget, I have taken the approach of including the appropriate .js file, instantiating the objects within it, then having the widget write its content to a div on the current page. The problem I am running into is that the objects created from the imported .js files don't seem to know which directory they came from anymore, so they cannot find the server side files they need to communicate with.
Is there a way that objects loaded from a .js file can know what their original source directory is? Is there a better way to architect this?
- Steve
Each widget I make will need to communicate with the server, so I have put each widget in its own directory and have it pull dynamic content from files in the same directory.
When I want a page (in another directory) to include the widget, I have taken the approach of including the appropriate .js file, instantiating the objects within it, then having the widget write its content to a div on the current page. The problem I am running into is that the objects created from the imported .js files don't seem to know which directory they came from anymore, so they cannot find the server side files they need to communicate with.
Is there a way that objects loaded from a .js file can know what their original source directory is? Is there a better way to architect this?
- Steve