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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:58:29+00:00 2026-06-17T16:58:29+00:00

I have an application with following coffeescript jquery code to do some ajax calls

  • 0

I have an application with following coffeescript jquery code to do some ajax calls :

  $('#records-filter-date').submit ->
$.get(@.action, $(@).serialize(), null,'script')
return false

$('#records-delete').submit ->
 $.post(@.action, $(@).serialize(), (data)->
  $('.check-for-delete:checked').parent().parent().hide(600,'swing')
  $('#alert-div').html("<div class='alert alert-success '><button class='close' data-dismiss='alert' type='button'>x</button><div id='flash_notice'>"+data+ " record(s) successfully deleted!</div></div>")
  $.get('#records-filter-date'.action, $('#records-filter-date').serialize(), null,'script')
,'text')
return false

Now the page lists certain records. the first call is to submit search fields via ajax. The second one is to delete selected records (using check boxes). Now I could just delete the records and redirect to the action that lists the records but the search params will be lost (if the user filtered records before deleting them) and they would have to filter records again.

So what I did was after the delete was called successful i called submitted the date in the search fields and thought of updating the records.

but… when there is no search params (when no search was done) the deletion works wel. but when I do a search and then I do a delete… the request is processed as a normal http request..

is there anyway to maintain the search params? or do I need to do anything to fix this?

EDIT: the form that submits records to be deleted is within the div updated by search call. could it be that the binding with the ajax call be broken when the div is updated?

  • 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-17T16:58:29+00:00Added an answer on June 17, 2026 at 4:58 pm

    the form that submits records to be deleted is within the div updated by search call. could it be that the binding with the ajax call be broken when the div is updated?

    Yes, that’s the problem. When you replace the HTML content of an element, all the existing elements inside it are removed from the DOM and their associated data and event handlers will go with them. Even if you’re replacing it with identical content, the resulting elements are new ones.

    You’ll need to use event delegation. Here’s the regular jQuery version of the code:

    $(document).on('submit', '#records-delete', function(e) {
        // your $.post() code here
    });
    

    Ideally, rather than document, you’d use a static element that’s closer in the heirarchy to the dynamic element (your #records-delete form would be the dynamic element here). In your case, that would be the selector for the <div> that contains that form.

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

Sidebar

Related Questions

I have an application using the following code to get input based on a
I have the following Application tag code in my widget: <mx:Application xmlns:mx=http://www.adobe.com/2006/mxml xmlns:local=* width=100%
I have the following situation: I have an application that collects some data from
We have an application parsing date/time values in the following format: 2009-10-10 09:19:12.124 2009-10-10
I have installed Google application engine following instructions here: http://code.google.com/appengine/docs/java/gettingstarted/installing.html However, running dev_appserver.cmd script
Suppose I have an application with the following code: public class Node { public
I have the following application which get launched as below: Runtime.getRuntime().exec(java -cp /var/dist/Test.jar System.V
I have the following coffeescript code to generate and alert box: show_alert = ()
I have console application with following threading code. It seems when i hit Ctrl+C
I have the following application: I have 1 window. On that window I add

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.