1

Need to show the popup only when the data is loaded inside IFrame successfully. Currently popup gets visible even if the source of IFrame doesn't get loaded. Here is the code snippet:

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

I tried with the following, but it didn't work:

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

Kindly let me know the callback to confirm that "SRC" attribute is set in IFrame.

Pranav Kumar
  • 249
  • 1
  • 5
  • 16

1 Answers1

2

You should use jQuery as below::

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

UPDATED:
I have done this in JSFIDDLE, please check the link it will help you. and modify it as your need. Link: https://jsfiddle.net/a1kj8883/

Rana Ghosh
  • 4,514
  • 5
  • 23
  • 40
  • Thanks Rana for your quick reply. But, it is opening a modal popup without any data. Kindly help me out. – Pranav Kumar Mar 27 '17 at 17:36
  • please upvote and accept the answer if it helped you to helping others. – Rana Ghosh Mar 30 '17 at 18:08
  • Done.. Need one more help.. Kindly check the following : http://stackoverflow.com/questions/43125196/show-a-bootstrap-popup-and-then-revert-the-eventdrop-in-fullcalendar-based-on-us – Pranav Kumar Mar 30 '17 at 18:40