簡體   English   中英

回調以確認在IFRame中設置了“ SRC”屬性

[英]Callback to confirm that “SRC” attribute is set in IFRame

僅當數據成功加載到IFrame中時才需要顯示彈出窗口。 當前,即使未加載IFrame的源,彈出窗口也可見。 這是代碼片段:

$('#myIframe').attr('src', 'Student.aspx?roll=' + rollNumber);
$('#studentInfoPopup').modal('show');

我嘗試了以下操作,但沒有成功:

$("#myIframe").load(function(){
      $('#studentInfoPopup').modal('show');
}).attr('src', 'Student.aspx?roll=' + rollNumber);

請讓我知道該回調,以確認在IFrame中設置了“ SRC”屬性。

您應該使用jQuery ,如下所示:

$('#myIframe').attr('src', 'Student.aspx?roll=' + rollNumber);
$('#myIframe').load(function(){
  $('#studentInfoPopup').modal('show');
});

更新:
我已經在JSFIDDLE中完成了此操作 ,請檢查鏈接將為您提供幫助。 並根據需要進行修改。 鏈接: https//jsfiddle.net/a1kj8883/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM