Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8623781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:21:56+00:00 2026-06-12T07:21:56+00:00

When the page loads, a cookie is created via PHP prior to any other

  • 0

When the page loads, a cookie is created via PHP prior to any other content or headers with this code:

$steam_login_verify = SteamSignIn::validate();
if(isset($_COOKIE['userid']))
{
     //work with cookie value to get data;
     $steam_login_verify = $_COOKIE['userid'];

     $id = new SteamId($steam_login_verify);

     $name = $id->getNickname(); 
     $baseUrl = $id->getBaseUrl();
     $medAvatar = $id->getMediumAvatarUrl();
} else if(!empty($steam_login_verify))
{
     //create the cookie and store the user id as the value
     $exDate = time()+60*60*24*365;
     setcookie('userid', $steam_login_verify, $exDate,'/');

     $id = new SteamId($steam_login_verify);
     $name = $id->getNickname(); 
     $baseUrl = $id->getBaseUrl();
     $medAvatar = $id->getMediumAvatarUrl();
}

I am then using James Auldridge’s cookies plugin for jQuery to manage the cookie.

Once the user logs in via Stream, their Steam64Id is stored in the cookie for a year to keep them from having to log in every time they visit they page (assuming they will visit it on a regular basis).

I then use the Steam64Id in an ajax call to get all of the users friends and populate a select element with their names.

On the page is a “Logout” button that, when clicked, will delete the cookie and refresh the page, causing the user to have to login via Steam again. This is where I am having the issue.

As long as the ajax call is running (and it takes a while to run ~57 sec) the logout button works just fine. Once that call is complete and the select element is populated, the logout button fails with an error in the console:

Uncaught TypeError: Cannot call method 'del' of undefined

The code that this error refers to is the function that deletes the cookie and refreshes the page:

$('#logout').click(function() {
     $.cookies.del('userid');
     window.location.reload();
});

I do not understand the error, or why it is being thrown. Any help here would be great.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:21:57+00:00Added an answer on June 12, 2026 at 7:21 am

    I would have to see more client side code and the AJAX response to be sure, but I suspect that the AJAX response includes a SCRIPT tag which reloads jQuery, causing all loaded plugins ($.cookies reference included) to be deleted.

    Remember that $.cookies is an alias to jaaulde.utils.cookies so part of your troubleshooting could be to use that instead and see if it works then.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using wordpress and have created a cookie in functions.php. My problem is
My page loads a TextView which is scrollable. Unfortunately the position appears to stick
My Jquery ajax page loads and shows up in the DIV that lays itself
When my Silverlight page loads, I want to set focus on a control. Simple
After my page loads my text disappears and I am having trouble determining why.
everytime my page loads, im supposed to create a datatable (also a jquery plugin)
I have an html page that open a popup window when the page loads.
I have a form which has three inputs when the page loads -- 2
I would like for the pop up to appear once the page loads, without
What I'm trying to do: Create a 'grid' once the page loads with some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.