I have a case where the backend is sending html to a jsp page containing an iframe. The iframe src is set via an ajax call as shown below :
$(document).ready(function() {
$.ajax({
type: "get",
url: "http://someurl/",
success: function(msg){
console.log("Success" + msg);
$('#frameId').attr('src','data:text/html,'+ msg);
}
});
});
However the html that is set contains script tag which contains window.onload function as shown below :
<script>
window.onload = function () {
//some processing done here
}
As I understand , this onload wouldn't be called as the iframe src is set by the ajax call whereas the iframe has already loaded. How can this function be invoked ?