5

in my a.html i write this:

<script>
function Flike()
{ jQuery('#ft').load('like.php'); }
</script>

in the body of a.html i write

window.onload = Flike()

like.php is:

echo " <script> var e = document.createElement('script');
e.async = true;
e.src = '/facebook/like.js';
document.getElementById('ft').appendChild(e);
</script>
";}

Still now, All fine and works.

the problem is in like.js the script isn't work. this is like.js

I also tried without the document ready function... didn't work.

0

1 Answer 1

4

window.onload = Flike() is wrong

It should be

window.onload = Flike;

but if you are using jQuery, why are you not adding it

$(window).load(Flike)

And if you are just loading a script, why are you not using

$.getScript("/facebook/like.js");

Finally, if you are calling this after the page load, the document.ready event will not fire again for this new script.

Sign up to request clarification or add additional context in comments.

3 Comments

in the php there is if else... $.getScript("/facebook/like.js"); is in php echo.. now the script load but break the page
breaks the page how? Lack of details = no help.
The problem is in like.js file. if i use simple javascript like hello world it works, but when i use like.js the is a problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.