A few days back I got a code challenge for a cool job position. For whatever reason the test was very light on Rails very heavy on JQuery, which I didn't know much about frankly. So in less than 24 hours I had to not only learn enough of it but also make it work into a modal window widget. I got it done, but it wasn't elegant at all. I clobbered it even if it worked. The first challenge was to get information into webpage from a Rails application, I chose JSON and thought it'd be easy-peasy, but transferring a JSON object is a cross-domain script violation and most browsers won't let it pass. So I learned about JSONp which wraps the JSON object in a JQuery call-back. Lacking the easy Ruby ways of determining what things are, at first I'd no idea what the JSONP object was and just had my Rails app send JSON. Once I figured what it was, it was trivial to get Rails to do it. All I had to do was add: :callback => params[:callback] to the format property in the con...
© David Acevedo