The following itty-bitty snippet loads a page from my site (the new connection type page in this case), grabs the form out of it, injects it into a div which gets injected into the body of the page, then calls dialog on it.
ComPLETEly unobtrusive, and I don’t have to mess with any of my controllers or views to make it work.
Ahhh the simplicity.
<a href="/connection_types/new/" class="popup">Add Connection Type</a>
$('a.popup').click(function() {
$('<div />').appendTo('body').load($(this).attr('href') + ' form').dialog({
title: $(this).text()
});
return false;
});
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
I bookmarked this site, Thank you for good job!
I want to say – thank you for this!
Wow.. that saves the rest of the night for me.. thx alot!!!
Great! Glad it helped.
Brilliant, I spent a lot of time trying to do this. Your solution is perfect for me. Thanks a lot for sharing.