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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:13:47+00:00 2026-05-12T11:13:47+00:00

I have a page with a list of items initially loaded from a include_once(‘show_calendarV2.php’);

  • 0

I have a page with a list of items initially loaded from a include_once('show_calendarV2.php'); line.

Next to each item is a delete icon that triggers the following jquery to delete the item from the db and then update the page.

$('.delete_schedule_item').click( function() {
     var id = $(this).next('input[type=hidden]').attr('value');
     alert ( id );

     $.ajax({
          url: 'ajax/delete_schedule_item.php',
          type: 'post',
          data: { id: id },
          dataType: 'json', // get back status of request in JSON
          success: function(data) 
          {
              //alert( 'item deleted' );
          }
         //           if (data.status) {
         //            alert('success');
         //          }
         //          else {
         //             alert('error');
         //         },
         //... other parameters/callbacks ...
         });

     $.get('show_calendarV2.php', {},      
        function(data) 
        {
        //load the calendar data
        $("#calendar").html( data );

       });
    });

Everything works fine the first time an item is deleted.
The item is deleted.
The new page loads.

But after the page loads the delete buttons? jquery calls? no longer function.

The same page is used to create the initial display as well as the refreshed one so am not sure why the code fails.

Ideas?

  • 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-12T11:13:48+00:00Added an answer on May 12, 2026 at 11:13 am

    Try changing

    $('.delete_schedule_item').click(function() {
    

    to

    $('.delete_schedule_item').live("click", function() {
    

    If you load a bunch of new html, the function that you ran before wouldn’t apply to it anymore. And since you’re loading it via Ajax, the function isn’t executed again once it’s done loading.

    The beauty of the live() and die() functions in jquery is that they take care of this situation. Whenever something new is loaded that matches the selector, the new elements are updated automatically.

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

Sidebar

Related Questions

I have a dropdownlist in a page. The values of all the list items
I currently have a page that contains an unordered list. That list is initially
I have a page where i have a sortable list of items (a div
I have a couple of list items in a shared _layout.cshtm file (master page)
I have a page in my application that refreshes some content (a list of
I have a simple accordion type page containing a list of H3 headers and
I have a list of bean objects passed into my JSP page, and one
I have a asp.net page where i query a list of url and the
I have a software diagnostic page on which I would like to list the
I have a ListView on a page that displays a list of widgets. When

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.