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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:26:13+00:00 2026-06-09T15:26:13+00:00

i am trying to get a button on my page which will eventually be

  • 0

i am trying to get a button on my page which will eventually be a delete button to work. However because it is a <li> element and not your average submit button with a form etc… i have to use ajax to send all the variables to be processed, at the moment i just want them to be in a state where they can be processed, but at the moment my script doesn’t seem to return any value like i want it to and output them.

Hopefully from the code below you will see what i mean, all i need it to do at the moment is just select all the values from the checkboxes which are cehcked and send it to the mail_trash.php, and then just send it back and output the array, just so i can see it is selecting the proper values etc… The actual delete php code is already written and working, this is just to check the Ajax.

Here is the javascript and ajax

    <script>
        $("document").ready(function (){ 

           $("li.trash").click(function(e){  
                 var db = $(':checkbox:checked').map(function(i,n) {
                    return $(n).val();
                 }).get(); //get converts it to an array

             if(db.length == 0) { 
             db = "none"; 
           }        

    $.ajax({
            type: "GET",
            url: "mail_trash.php",
            data: {'db[]':db  },
            dataType: "json",
            statusCode: {
                200: function (response) {
                                                                                           $("#mail_header_name").html(response.mess_id);

                                         }

            }
        });
    });

});


</script> 

And here is the script for the mail_trash.php

  <?php

    include 'connect_to_mysql.php';

    $mess_id = $_GET["db"];
    echo json_encode($mess_id);


?>

And just to check things the

  • button

    <li><a class="trash" href="">&nbsp;</a></li>
    

    Thank you so much for your help, this has been bugging me for the last couple of hours.

    • 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-09T15:26:14+00:00Added an answer on June 9, 2026 at 3:26 pm

      It’s not li.trash. It’s a.trash because trash is a class of the a element. As such the first three lines of the js should be:

         <script>
          $("document").ready(function (){ 
      
             $("a.trash").click(function(e){  
      

      and then so on with the rest of you code. I haven’t checked the rest of your code necessarily, although I am pretty iffy about $(‘:checkbox:checked’) as I don’t think that’s correct jquery…. To start off, I’d suggest fixing the first selector I mentioned, checking the second with jquery docs and then jshinting/jslinting your code. (Javascript only)

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

    Sidebar

    Related Questions

    On My Demo Page I'm trying to create a button which will inevitably be
    I'm trying to get a button which looks exactly the same whether it is
    I'am trying to get the Login button from Facebook to work on my website
    Hey there, I am trying to get my signout button to work. This is
    So I am trying to get a border around buttons on my page when
    I have a C# winforms application and I am trying to get a button
    I am trying to get my first button to update a display number in
    I am trying to get my like button on my website www.nacts.com.au to add
    im using the WPFToolkit's DataGrid and im trying to get an edit button working,
    Trying to get the id of the radio button that is checked in android,

    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.