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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:09:23+00:00 2026-05-27T07:09:23+00:00

I know I need to use the . something like .live to get this

  • 0

I know I need to use the . something like .live to get this to work but I am just confusing a h3ll here.

I have a list of data being pulled from a DB. Each Item has a form attached to it for deleting the item from the database.

OK here is the submit function for the form:

$(document).delegate('#delete_cat_form','submit', function() {

    var cat = $('#cat-name-imput').val(),
    id  = $('#cat-id-imput').val();

        $.post("ajax.php", {name:cat,id:id,action:'delete_cat'}, function(data){

                //Display a brief message!
                $("#message").fadeIn(3000).html(data);

                $("#message").fadeOut(3000).html(data);

                refreshMenu(); // Refresh Menu                      
            });

    return false;

});

The refresh menu function is this:

function refreshMenu(){

    $('.menu-million-dollar-wrapper').load('ajax.php', {action:'refreshMenu'}, function(data){

    });

}

Functions work on the initial load of the document but only once. After the ajax returns an update query from ajax.php it seems that all event handlers are gone and nothing works again.

I have tried reading some other answers that seem to be the same as might but I just can’t grasp the concept for some reason.

How can I do a query for new content and display it and at the same time not loose any event handlers?

Here is what ajax.php returns when called.. This is raw but I have confirmed that it does return the same exact HTML but updated with fewer and more items

 <form class="edit-button" method="post" action="'.$_SERVER['PHP_SELF'].'">
    <input type="hidden" name="name" value="'.$row['name'].'"/>
    <input type="hidden" name="id" value="'.$row['id'].'"/>
    <input type="hidden" name="action" value="delete_cat"/>
    <input type="submit" value="Delete"/>
</form>

$_SERVER['PHP_SELF'] is not correct but should not play a role in this problem.

This is the same code that is used to initially show the form on load as well.

  • 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-27T07:09:24+00:00Added an answer on May 27, 2026 at 7:09 am

    Try changing all your elements to classes instead of IDs, since you mentioned that there are more than one.

    $(document).on('submit', '.delete_cat_form', function() {
        var self = $(this);
    
        var cat = self.find('.cat-name-imput').val(),
        id  = self.find('.cat-id-imput').val();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to use method like: DoSomething<(T)>(); But i don't know which Type i
I have something like this: $('element.selector').live(click, function (){ run_some_func (); }); $('element.selector2').live(click, function (){
I need your help. I need to create live wallpaper like this : Bikini
i have a button that is created dynamically so i need to use .live
if given a graph problem how do we know whether we need to use
Somebody know how use OpenX (php app) with Django? I need to use OpenX
I know that to find all the .h files I need to use: find
Why does C++ need and use pointers? I know they add power to the
I use huge data files, sometimes I only need to know the number of
In order to use normal mapping in GLSL shaders, you need to know the

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.