I have created jquery functions and put them in a js file and called the file from my php using <script src="newajax.js"></script>
.
This was working and now it has stopped working.
If i copy all my functions into the php file between the <script></script>
tags, It works. I know there is not any issue with the js script.
To test I only added
$(document).ready(function(){
alert("ready");
});
into the js file and called it from my php. It did not show the alert but when I did this inside the php file
<script>
$(document).ready(function(){
alert("ready");
})
</script>
It worked.
So I know there isn't any issue in the php file. It just looks like the script is not being picked up and it was before with exactly the same code. I have not removed the files to a different location. The js files are in the same directory as the php file.
Anybody encountered such an issue? Or know a reason why this could happen. FYI - I know they are html tags but I have used php extension to be able to run php functions in my file. The jquery.js file is loaded first before my js file.
When I loaded the webpage in a new tab, it worked. I was refreshing the same browser window when the .js script stopped being called.