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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:24:42+00:00 2026-06-04T06:24:42+00:00

OK, not really sure if this is possible but thought I’d ask anyway :)

  • 0

OK, not really sure if this is possible but thought I’d ask anyway 🙂

I have a HTML page which contains some information and a link.
The link calls a JavaScript confirm dialog box.
If the user selects OK then I want to call a function in a PHP file, but in the background, i.e I don’t want to change page, reload or anything.

Is this possible?

Thanks

T

  • 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-04T06:24:44+00:00Added an answer on June 4, 2026 at 6:24 am

    Use AJAX. The following uses jQuery:

    if(confirm('Are you sure?')) {
        $.ajax({
            url: '/path/to/file.php',
            data: 'url=encoded&query=string', // Can also be an object
            success: function(output) {
                // This function is called after the PHP file completes.
                // The variable passed in is a string containing all output of
                // your PHP script (i.e. echo / print )
            }
        });
    }
    

    For more information, check out jQuery’s documentation for AJAX. If you cannot use jQuery, there are many tutorials on using native JavaScript to make AJAX Requests.

    If you are returning a large amount of data back to your success function from PHP, it would be worthwhile for you to return the data from PHP as a JSON encoded array, which can be safely parsed client-side into a JavaScript object.

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

Sidebar

Related Questions

I know this is possible but I'm not really sure where to start. Has
I am not sure how to really word this, but I have a game
I'm not sure if this is possible, but I thought it would be cool
Sorry, I'm not really sure of the right way to ask this one so
I feel like there's a simple solution to this, but I'm not really sure
I know this probably really simple but Im not sure what im doing wrong...
I've thought long and hard about this and I'm really not sure if it's
I'm not sure if something like this is even possible in Python, but if
I am not really sure what this method does, or better I am not
Not really sure how to phrase this other than by example.. Given... DATABASES =

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.