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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:59:42+00:00 2026-05-25T10:59:42+00:00

I am in a pickle right now… I have this function that gets 2

  • 0

I am in a pickle right now… I have this function that gets 2 variables from a page then run a sql query after it grabs the data.

function delete(id,date){
    confirmdel=confirm('Are you sure?');
    if(confirmdel){
      var curid = id;
      var when = date;

      //sql code should go here   

    }
    else{
      //don't do anything
      return false;
    }
  } 

How do I run an sql query from the function or send the data to a php file? I tried using jquery but it would just ignore it, so if I can use jquery please explain/give an example of how to use it.

  • 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-25T10:59:43+00:00Added an answer on May 25, 2026 at 10:59 am

    JavaScript can’t deal with databases on its own, it just can tell the browser what to do and is only loaded after the server has submitted the page to the browser. So I guess you’ll have to work with AJAX. This is quite simple using jQuery:

    ...
    
    $.post('process.php', {id:curid, date : when}, function(data) {
    
      alert(data);
      //data contains all output from process.php, 
      //either in json-format if you jsonencode a results-array
      //or just a simple string you echo in the php
    
      return false; //prevent from reloading the page
    });
    
    ...
    

    Your process.php could look something like:

    <?php
    
    $curid = $_POST['id'];
    $when = $_POST['date'];
    
    //run the query
    
    echo jsonencode($results_array);
    
    //or check if query succeeded and echo e.g. 'ok' or 'failed'
    ?>
    

    You get the idea… 😉

    //EDIT:

    You should probably use the jQuery UI for the dialog-box to avoid the message as described in the comments. It could be something like this:

    <div id="dialog_box" style="display: none;">
        Really delete?
    </div>
    
    $('#dialog_box').dialog({
      title: 'Really delete this stuff?',
      width: 500,
      height: 200,
      modal: true,
      resizable: false,
      draggable: false,
      buttons: [{
      text: 'Yep, delete it!',
      click: function(){
          //do the post
        }
      },
      {
      text: 'Nope, my bad!',
      click: function() {
          $(this).dialog('close');
        }
      }]
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to pickle a file that sometime's is empty. Right now its empty,
I am a bit of a pickle right now: I have an image displayed
I have an application that imports data from a pickled file. It works just
I have an object with a CookieJar that I want to pickle. However as
I am in a bit of a pickle right now. I am building a
I'm not entirely sure of the steps that caused this however I have ended
I'm trying to pickle a request object so that I can run my view
I've run into a bit of a pickle here. I have a custom profile
Assume I have a class A and a class B that is derived from
I have a commandline application coded in delphi that I need to call from

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.