jquery - How to integrate a modal dialog -


i want show ajax error messages form validation , want these messages centered on screen. advised use modal window this. have following code i'm not sure how this. know need call modal in success function unfortunately that's extent of jq knowledge.

this jq script modal should integrated

  success: function(data){     ...     if(data.success == 0){       $(div).addclass('ajax-error');     } 

this modal code. code set work hyperlink activates window don't need that. window should invoked automatically upon error in code above.

  $('a[name=modal]').click(function(e) {     e.preventdefault();      var id = $(this).attr('href');      var maskheight = $(document).height();     var maskwidth = $(window).width();      $('#mask').css({'width':maskwidth,'height':maskheight});      $('#mask').fadein(1000);     $('#mask').fadeto("slow",0.8);      var winh = $(window).height();     var winw = $(window).width();      $(id).css('top',  winh/2-$(id).height()/2);     $(id).css('left', winw/2-$(id).width()/2);      $(id).fadein(2000);   });    $('.window .close').click(function (e) {     e.preventdefault();      $('#mask').hide();     $('.window').hide();   });    $('#mask').click(function () {     $(this).hide();     $('.window').hide();   }); 

i check out jquery model dialog plugin.

the documentation bit sparse, demo page , friends firefox , firebug paint pretty complete picture.

it has autoclose feature want.

the plugin applies opaque mask , has div styles such "dialog-header," "dialog-title," , "dialog-close" allow style appearance.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -