I wrote this cool little JavaScript AJAX Library that I want to use in several applications.
It works similar to Google suggest except clicking on the item will copy hidden data to the form elements, speeding up data entry. Some JavaScript coding will be required for each project but the majority of it isn't project specific.
What is the best way to make it work with php on a per project basis without rewriting it each time?
I thought of an object. The object will echo the style sheet, script tag with external js script, and the div boxes used for data containers. I would pass it the names of the call back JavaScript functions to call when the user selects an entry.
I haven't done anything like this before so I wondered if there are any drawbacks to this approach that I might be overlooking?