> Anyway, of course, in most cases, I could wrap my functions into one, > but my problem is that I don't have access to one of the > Event.observer registrations since it's been wrapped up in output > produced by PHP. My functions are dependent on that handler to be > called first. And I don't want to change the PHP because the PHP > classes are suppose to abstract the implementation of the tool, and > having to register a function outside the PHP that was created inside > the PHP breaks that abstraction. > Man that sounds confusing... What events are you observing exactly?
I'm sure there has got to be a better way of doing what you are doing. Try posting a step by step explanation or sample code of what you are trying to accomplish and maybe we can suggest a better way for you. It might mean major changes on your existing code, but I've found that keeping all JS in JS files and only using PHP to serve the initial page and handle requests by processing *only* data is the way to go. The limited scope of eval'ing code returned by the server is very prone to error and increasing complexity, not to mention you can take advantage of browsers caching your JS files. My rule of thumb: unless I need raw data that is exclusive to the server, don't make an Ajax request. For example, an HTML form is something that can be generated client-side. If you want to auto-fill the form, generate it and fill it with data that is retrieved from the server, don't generate the form server-side if it uses complicated listeners etc... JSON and Builder.node are your friends :) Trust me, I just rewrote some old code that fetched a complex form from the server which had event handlers for various things, and the rewritten code which generates the form using javascript is so much cleaner and easier to understand and easier to debug. Colin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
