Consider this code:
function callme() {
alert('call');
}
$(function(){
var iframe = $('<iframe />').attr('src', 'b.php').appendTo('body');
//call 'callme' function from parent
});
I don’t want to edit b.php.
Is there any way I can call the parent ‘callme’ function using just javascript in the parent file?
Not sure about the part “I don’t want to edit
b.php“. Your question is asking about how to call the parent function from an iframe andb.phpis in the iframe. How can you make it call the parentcallme()without modifyingb.php?From
b.phpyou can callOr is your question, how can I call
callme()afterb.phpfinishes loading?