# Javascript Dialogs and AJAX

**URL:** <https://discuss.rubyonrails.org/t/javascript-dialogs-and-ajax/274>\
**Category:** rubyonrails-talk\
**Created:** [August 22, 2006, 8:16pm UTC](https://discuss.rubyonrails.org/t/javascript-dialogs-and-ajax/274 "2006-08-22T20:16:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![phil.swenson](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@phil.swenson](https://discuss.rubyonrails.org/u/phil.swenson)\
**Post date:** [August 22, 2006, 8:16pm UTC](https://discuss.rubyonrails.org/t/javascript-dialogs-and-ajax/274/1 "2006-08-22T20:16:51Z")

</div>

I've tried using libraries such as Lightbox, ThickBox, or iBox for dialogs in my Rails apps (for example, thickbox is at

> **[Cody Lindley | Front-end/Client-side/JavaScript Engineer | Boise,Idaho](http://codylindley.com/Javascript/257/thickbox-one-box-to-rule-them-all)**
>
> Cody Lindley is a front-end/JavaScript developer and recovering Flash developer. He has an extensive background working professionally (25+ years) with HTML, CSS, JavaScript, and client-side performance techniques as it pertains to web development....

). They work great for simple stuff, but when I use them to host forms and try to update divs inside the dialogs, I get weird results.... like RJS javascript outputs directly to the screen instead of being executed.

Has anyone tried updating dialogs like this? What libraries have you used.

Thanks, phil

---

<div class="post-metadata">

**Author:** ![Chris\_Boone](https://avatars.discourse-cdn.com/v4/letter/c/8e7dd6/32.png) [@Chris\_Boone](https://discuss.rubyonrails.org/u/Chris_Boone)\
**Post date:** [August 22, 2006, 9:26pm UTC](https://discuss.rubyonrails.org/t/javascript-dialogs-and-ajax/274/2 "2006-08-22T21:26:13Z")

</div>

I've had poor luck using those types of libraries for dialogs. I've had good luck, on the other hand, with the YUI Dialogs:

[http://developer.yahoo.com/yui/container/dialog/index.html](http://developer.yahoo.com/yui/container/dialog/index.html)

It's fairly powerful and quite stable. In general, once you get the hang of Yahoo's conventions -- and the limitations of the library -- it works very well.

We started to use it for Lingr -- [http://lingr.com](http://lingr.com) -- but decided that we couldn't justify forcing that much JS on chatters just for a sign-in dialog. That's the downside of using YUI: even if you only want a little, you have to accept a lot.

---

<div class="post-metadata">

**Author:** ![Jim\_Weir](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@Jim\_Weir](https://discuss.rubyonrails.org/u/Jim_Weir)\
**Post date:** [August 22, 2006, 10:59pm UTC](https://discuss.rubyonrails.org/t/javascript-dialogs-and-ajax/274/3 "2006-08-22T22:59:51Z")

</div>

take a look at DOJO Toolkit.

[http://dojotoolkit.org/](http://dojotoolkit.org/)

Jim

---

<div class="post-metadata">

**Author:** ![Dee\_Zsombor](https://avatars.discourse-cdn.com/v4/letter/d/9fc29f/32.png) [@Dee\_Zsombor](https://discuss.rubyonrails.org/u/Dee_Zsombor)\
**Post date:** [August 23, 2006, 6:42am UTC](https://discuss.rubyonrails.org/t/javascript-dialogs-and-ajax/274/4 "2006-08-23T06:42:35Z")

</div>

I used Lightbox (the [Particletree » Lightbox Gone Wild!](http://particletree.com/features/lightbox-gone-wild/) version) with rjs quite heavily, while it worked well. You might want to check if the rjs response comes back with the proper content type. Normally this is the case, unless your app was developed with an earlier rails version and you have left set\_content\_type kind of filter in. A quick test would be rjs templates without lightboxes.

zsombor

---

<div class="post-metadata">

**Author:** ![John\_Ward](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@John\_Ward](https://discuss.rubyonrails.org/u/John_Ward)\
**Post date:** [August 23, 2006, 7:41am UTC](https://discuss.rubyonrails.org/t/javascript-dialogs-and-ajax/274/5 "2006-08-23T07:41:15Z")

</div>

I'd recommend using prototype-windows. It's advantage is it's based on the prototype library already included with rails.

[http://prototype-window.xilinus.com/](http://prototype-window.xilinus.com/)

Dee Zsombor wrote:
