I can't find the reason why the below code is not working. It seems like an ordinary "test" alert, but it does not work!
This is a .php file with the following code:
<?php
require_once('../../usefull/functions');
if(!session->loggedIn)
{ redirect_to("../index.php"); }
?>
<link href="../ssheet.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../scripts/Image.js"></script>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
alert("hello");
});
</script><?php
<div id="imagelist"></div>
Thanks in advance!
ANSWER:
It appeared there was a bug in my SelectImage file. An element was called which does not exist on this particular PHP file.
Your syntax is close, but no cigar. Literally just missing a ). RTM...
$( document ).ready(function() {
$(document).ready(function() {
alert("hello");
});
You missed one bracket in your code
the closing bracket is missing after "document" variable. The correct form is
$(document).ready(function(){
alert("hello");
});
In the php code: if(!session->loggedIn)
I believe you are missing a $
before session. Ex. if(!$session->loggedIn)
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
alert('Hello');
});
</script>
</head>
<body>
</body>
</html>