This is my php file where it creates a session for the user:-
<?php
//starting the session
session_start();
//checking if session of user is set ot not
if(isset($_SESSION['UID'])) {
echo "Welcome, ".$_SESSION['UID'];
}
else {
header("Location: ErrorPage.html");
}
?>
And this is my jQuery file:-
$(document).ready(
function hiding() {
$("#links").hide();
}
);
I want my “#links” to be hidden after a user logs in. How do I include the jQuery file in my if statement in php? I tried:-
include("jqueryFile.js");
require("jqueryFile.js");
But it didn’t work.
Require and include is for server side files, like php.
you should simply do something like
If you want to use the require/include commands you should store your javascript in a .php file
require('jqueryFile.php');