Featured Post

My Personal Couch-to-5K Program

I have always hated running. It was one of those things that just seemed pointless, mindless, and boring to do. I tried a few times in my life to pick up on it, but it always failed for some reason or another. I’ve recently decided to take it up again. Read on and follow my progress. My History...

Read More

Simple, Reusable jQuery AJAX Dialog

Posted by Joe King | Posted in Web Development | Posted on 17-08-2010

Tags: ,

0

While working on a project recently, I needed a simple way of reusing a jQuery ajax dialog. The problem with the default jQuery UI dialog is that when it is closed, it is destroyed, making it unusable again.  I wanted a way to basically pass any URL to it and have it load in the dialog.

There are lots of plugins to accomplish this, but here is a dead simple way. Just surround the dialog div with a containing div (id=dialogcontainer), and recreate the dialog div (id= dialog) on each call.  The URL is passed via the value attribute.










Reusable Ajax Dialog using jQuery

Reusable Ajax Dialog 1
Reusable Ajax Dialog 1
Reusable Ajax Dialog 1
Reusable Ajax Dialog 1

Write a comment