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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:30:23+00:00 2026-06-04T08:30:23+00:00

I wonder whether someone may be able to help me please. Firstly, apologies because

  • 0

I wonder whether someone may be able to help me please.

Firstly, apologies because I’ve only just started to use Javascript, so I’m perhaps I’m making a very basic mistake, so please bear with me.

I’m trying to implement Example 2 from this piece of third party software in my gallery page shown here.

Shown in the code below, I’ve been able to add the message to the onclick event i.e. when the user clicks the ‘bin’ icon, but the AJAX piece of code that is supposed to run upon the ‘Delete’ button being clicked is failing:

<script type="text/javascript"> 

    Galleria.ready(function() {
        this.$('thumblink').click();

    $(".galleria-image").append( 
    "<span class='btn-delete ui-icon ui-icon-trash'></span>"); 
    $(".btn-delete").live("click", function(){
    $.msgbox("You are about to delete this image. It cannot be restored at a later date. Do you wish to continue?", {
    type: "alert",
      buttons : [
        {type: "submit", value: "Delete"},
        {type: "cancel", value: "Cancel"}
      ]
      },function(Delete) {
      var img = $(this).closest(".galleria-image").find("img"); 
      // send the AJAX request
      $.ajax({
        url : 'delete.php',
        type : 'post',
        data : { image : img.attr('src'),  userid: "VALUE", locationid: "VALUE"},
        success : function(){
        img.parent().fadeOut('slow');
    }
    });               
    });
    return false;
    });     
    });

</script>

I’m really not sure where I’ve gone wrong here, despite spending some time disecting the code. I just wondered whether someone could perhaps look at this please and let me know where I’ve gone wrong.

POST UPDATE
WORKING SOLUTION

<script type="text/javascript"> 

        Galleria.ready(function() {
            this.$('thumblink').click();

        $(".galleria-image").append( 
        "<span class='btn-delete ui-icon ui-icon-trash'></span>"); 
        $(".btn-delete").live("click", function(){  
        var img = $(this).closest(".galleria-image").find("img"); 
        $.msgbox("You are about to delete this image. It cannot be restored at a later date. Do you wish to continue?", {
        type: "alert",
          buttons : [
            {type: "submit", value: "Delete"},
            {type: "cancel", value: "Cancel"}
          ]
          },
          function(result) {
          if(result)

          // send the AJAX request
          $.ajax({
            url : 'delete.php',
            type : 'post',
            data : { image : img.attr('src'),  userid: "VALUE", locationid: "VALUE"},
            success : function(){
            img.parent().fadeOut('slow');

    }
        });               
        });
        return false;
        });     
        });

    </script>

Many thanks and regards

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

    I have renamed the variable Delete to result.

    function(result) {
      //result variable holds the value of what user clicks 'Delete' or 'Cancel'. 
      //Cancel click will pass false.
      //Delete click will pass Delete.
      alert(result)
      //You can also check if(result=='Delete') instead of if(result)
      if(result)
      {
          var img = $(this).closest(".galleria-image").find("img"); 
          // send the AJAX request
          $.ajax({
            url : 'delete.php',
            type : 'post',
            data : { image : img.attr('src'),  userid: "VALUE", locationid: "VALUE"},
            success : function(){
            img.parent().fadeOut('slow');
        }
      }
    

    See if this works.

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

Sidebar

Related Questions

I wonder whether someone may be able to help me please. Firstly apologies, because
I wonder whether someone may be able to help me please. Firstly, apologies, I'm
I wonder whether someone may be able to help me please. I currently use
I wonder whether someone may be able to help me please. I'm using Aurigma
I wonder whether someone may be able to help me please. I've put together
I wonder whether someone may be able to help me please. Using some excellent
I wonder whether someone may be able to help me please. I'm using the
I wonder whether someone may be able to help me please. From some demos
I wonder whether someone may be able to help me please with a error
I wonder whether someone may be able to help me please. I'm trying 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.