JQuery - iFrame in div dialog

>> Parent Window: Main.aspx

function showStoreLocation(type)
{
         var _url = "getStoreLocation.aspx?type=" + type;
         var _iframe = '<iframe src=\'' + _url + '\' width="100%" height="100%" frameBorder="0" style="margin:0px;padding:0px;" scrolling="yes" id="iframe" name="iframe"></iframe>';

         $(document).ready(function() {
                $("#dialog").dialog({
                   modal: true,
                   height: 500,
                   width: 350,
                   title: 'STORE LOCATION',
                   close: function () { $("#TextBoxStoreLocation").focus(); }
                });   

                $("#dialog").html(_iframe).dialog("open");
         });
}

>> iFram File: getStoreLocation.aspx

Javascript Code:

//Send the value to the TextBoxStoreLocation in parent window (Main.aspx)
parent.$("#TextBoxStoreLocation").val(code);

//close dialog
parent.$("#dialog").dialog("close");

Popular posts from this blog

SAP CPI - Loop Process Call with SuccessFactor (oData V2)

Setting IntelliJ IDEA to run Groovy Script

C# - BASE64 to Image