views:

110

answers:

2

Hello,

I am wondering why would iframe work on localhost and not on a webserver online?

<iframe id='i_frame' src=''></iframe>

<script language='javascript' type='text/javascript'>

$(document).ready(fucntion() {

$('#i_button').bind('click',function(){

$('#i_frame').attr({src,url});

});

});

</script

Thanks Jean

+1  A: 

Because the iframe is pointing to http://localhost/hello.php as opposed to http://website.com/hello.php?

Shadow
No, its only the file name that is changed inthe attrib
Jean
Did the best I could, with the information you had provided at the time ;)
Shadow
+1  A: 

Your function is misspelled

$(document).ready(fucntion() { });

Should be

$(document).ready(function() { });

Also missing the closing greater than sign on the closing tag of your script element.

alex
@alex, i quickly typed it in, that is not the errorthere is no javascript error
Jean
DON'T 'quickly type in code'. Show us something that actually represents the code you are testing!
David Dorward
@davidI meant i quickly typed in the code, thats all to it. when you click a button it should load an website.It works offline perfect, but online it does not
Jean
What button? There is no button in the code, and the JavaScript tries to bind to the iframe, not to any button - unless the button and the iframe share an id, which is illegal.
David Dorward