Monday, March 29, 2010

ajax load a jquery ui dialog box

$(function() {
        // ajax load a jquery dialog box
 $.fn.ajaxDialog = function(options) {
  var defaults = {
   autoOpen:false,
   modal:true,
   resizable:false,
   
  };
  var options = $.extend(defaults, options);
  var id = "dialog_"+Math.floor(Math.random()*11);
  var el = $("
").attr("id", id); $(this).after(el); el.dialog(options); $(this).click(function () { url = $(this).attr("href"); $("#"+id).load(url,{}, function() { $(this).dialog('open'); }); return false; }) }; $("a.dialog_link").ajaxDialog({width: '890px', height: '800px'}); });

No comments:

Post a Comment