I am uploading files using a hidden iframe as a target...from inside this iframe I want to run a function that's on my main page.
In my target iframe.php
I have
<script>
upload_completed(<?php echo $numerolinha ?>);
</script>
but I get from firebug:
ReferenceError: loading_linha_21 is not defined
parent.upload_completed();</script>
If I run upload_completed(loading_linha_21);
on my main page it runs ok so I'm guessing the command to run the function on the parent page isn't working... help!
I also tried :
window.top.upload_completed(<?php echo $numerolinha ?>);
window.upload_completed(<?php echo $numerolinha ?>);
my functions :
<script >
function upload_started(id){
$(id).css("display","block");
}
function upload_completed(id){
$(id).css("display","none");
}
</script>
The best guess i can give you is that the jQuery function requires the id to be #name_of_id
, so when you call the function from the iframe like so:
parent.upload_completed('#<?php echo $numerolinha ?>');
or you can change your function to do this:
function upload_started(id){
$( '#' + id).css("display","block");
}
function upload_completed( id ) {
$( '#' + id ).css("display","none");
}
Put a '
inside function like below :
<script>
upload_completed('<?php echo $numerolinha ?>');
</script>