Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery dialog to open another page

There is a page as transaction.html

How to open this page in a popup in another page say show_transactions.html in a jquery dialog

       $dialog.html()  //open transaction.html in this dialog
     .dialog({
        autoOpen: true,
        position: 'center' ,
        title: 'EDIT',
        draggable: false,
        width : 300,
        height : 40, 
        resizable : false,
        modal : true,
     });
     alert('here');
     $dialog.dialog('open');

This code is present in show_transactions.html

Thanks..

like image 629
Hulk Avatar asked Dec 02 '22 05:12

Hulk


1 Answers

You can use jQuery's .load() method to load a page into a dialog, here's how:

$("#dialog").dialog({
    autoOpen: false,
    position: 'center' ,
    title: 'EDIT',
    draggable: false,
    width : 300,
    height : 40, 
    resizable : false,
    modal : true,
});

$("#dialog_trigger").click( function() {
    $("#dialog").load('path/to/file.html', function() {
        $("#dialog").dialog("open");
    });
})

This assumes the dialog has an ID of 'dialog' and that there's another element with ID of 'dialog_trigger' that is clicked to open it. You'd put both of these into your document's ready function so that the dialog is made on page-load, if it isn't, it will cause a slight-but-noticeable delay for the user as it's made.

like image 89
Zack Avatar answered Dec 04 '22 19:12

Zack