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 1023363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:36:24+00:00 2026-05-16T11:36:24+00:00

I wrote my own php captcha script, with a jpeg header, so that I

  • 0

I wrote my own php captcha script, with a jpeg header, so that I can say

<img src="captcha.php">

which works by storing the value of the captcha into the session variable. When the user can’t read it, I want it to be refreshable.

I first tried

$("#refresh").click(function() {
    $("#captcha").attr("src","captcha.php");
});

but of course that doesn’t make sense, and I need to make an ajax call instead.
How would you all recommend I do this?

P.S. I also tried

$.ajax({
    url: "captcha.php",
    success: function(result) {
        $("#captcha").attr("src",result);
    }
});
  • 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-16T11:36:25+00:00Added an answer on May 16, 2026 at 11:36 am

    The first method actually makes sense to me:

    $("#refresh").click(function() {
        $("#captcha").attr("src","captcha.php?r=" + Math.random());
    });
    

    I assume the only thing captcha.php does is store the captcha value in session variable and outputs the captcha image, whenever its accessed.

    So when you set the src of the image again and add a query string variable to it, a request is gonna be sent to the server script “captcha.php” again, which is going to then regenerate the captcha and store the new value in the session variable.

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

Sidebar

Related Questions

I have a Perl script I wrote for my own personal use that fetches
Alright, I recently wrote a ajax push script which had php on the backend
I wrote a small PHP script which does a branding on a present PDF
in php i wrote my own debug function which have two arguments: text and
I have to write a PHP script that works as a client against another
Since I'm using Postgresql and can't use LINQ to SQL, I wrote my own
I wrote my own trivial little function (php for convenience) and was hoping someone
I wrote my own cacheEngine for memcached as that's the extension I have installed
I wrote my own mvc for php, and it seems to be working fine
I have a PHP script that uses cURL to access a file also located

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.