views:

535

answers:

3
var pt_popup_options = {};

function pt_popup_iframe(sURL, sOkFunction)
{
    pt_popup_okfunction = sOkFunction;
    $("#pt_msgBox").css('width', '700px');
    $("#pt_msgBox").css('heigth', '500px');
    $("#pt_msgBox > p").html('<iframe style="width: 696px; height: 496px;" src="' + sURL + '"></iframe>');
    $("#pt_msgBox").modal(pt_popup_options);
}

When the popup is closed via a close button or the "x" top right of the popup, the iframe reloads and make a request to the server. It is not supposed to do that. Any idea to prevent that? I'm on Chrome and jQuery 1.4.2.

Thank you!

A: 

Seems to work with:


$("#pt_msgBox > p").html('<iframe style="width: 696px; height: 496px;"></iframe>');
$("#pt_msgBox").modal(pt_popup_options);
$('#pt_msgBox').find('iframe').attr('src', sURL);   
Sirber
+1  A: 

Another option if you're using jQueryUI's dialog, I wrote an extension a while ago that handles the various iFrame issues within a dialog...

http://plugins.jquery.com/project/jquery-framedialog

Tracker1
+1  A: 

I had the same problem.

Easiest way to fix it is to set the "persist" option.

$("#pt_msgBox").modal({persist:true});

//As of simplemodal-1.3.5 * persist: (Boolean:false) Persist the data across modal calls? Only used for existing DOM elements. If true, the data will be maintained across modal calls, if false, the data will be reverted to its original state.

Brandon Boone