call function from external js (php) file

Posted by bah on Stack Overflow See other posts from Stack Overflow or by bah
Published on 2010-06-15T16:29:38Z Indexed on 2010/06/15 16:32 UTC
Read the original article Hit count: 226

Filed under:
|

Hi, I have a file where I keep all scripts so my pages wouldn't get messy (I have php file which generates required javascript). My includes basically look like this:

</html>
<head>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="script.php"></script>
</head>
<body>
    <input type="button" onClick="return blah();" />
</body>
</html>

In script.php there's jquery wrapper $(document).ready where I keep all jquery related stuff. The funny thing is, when I put function blah() inside this wrapper I get "blah is not defined" error, but when I put it outside - works perfectly. So, what could be the problem?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery