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

  • Home
  • SEARCH
  • 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 6000659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:43:31+00:00 2026-05-23T00:43:31+00:00

This is a general question with no attempt so far since I don’t know

  • 0

This is a general question with no attempt so far since I don’t know where to start. All I’ve seen are javascript alerts upon leaving a page.

Scenario:

  • When User1 visit a page I want to generate a random string and make an entry in the database for that string.

  • This random number can be entered by one other user (User2).

  • I will check that the random number has an entry in the database before allowing User2 to “proceed”

When User1 leaves the page, I want to remove the entry from the database, so that if User2 enters the random string, it won’t be present in the database any longer/ won’t be valid anymore.

How do I trigger an event to delete the row upon leaving the page?

Not sure how else to describe this — if I’m making this more difficult than it needs to be or I’m just approaching the problem wrong, please point me in the right direction as to how to pull this off.

  • 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-05-23T00:43:32+00:00Added an answer on May 23, 2026 at 12:43 am

    Perhaps someone can prove me wrong, but as far as I know there isn’t a reliable way of triggering a server-side event when users leave a page.

    Yes, there is the onunload event that you can use to trigger a quick ajax call, but HTTP is by definition a stateless protocol and attempting to create a solution which emulate a stateful connection will have flaws. Consider:

    • users terminating the browser process instead of simply leaving the page
    • browsers with javascript disabled

    From your scenario, I suspect that you might be approaching your problem from a wrong angle. Do give more details on what you’re trying to achieve and someone might be able to help.

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

Sidebar

Related Questions

This is a general question about backbone.js and javascript, I'm intermediate in javascript: If
Yesterday I asked this general question about decimals and their internal precisions. Here is
This is a general question about MVC as a pattern, but in this case
This is a general question concerning technology decisions for a product development. My aim
This is a general question. And may not be specific to datagrids. How can
This is a general question about character encoding when using MD5 libraries in various
This is a general question. What are some techniques you employ to prevent the
This is a general question of sorts, but do you think that it's important
This is a general question, but I'll explain my specific need at the moment:
Ok this is a general question about how to solve this issue, not to

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.