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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:34:11+00:00 2026-06-09T04:34:11+00:00

My ajax looks like // send the data to the server using .ajax() or

  • 0

My ajax looks like

   // send the data to the server using .ajax() or .post()
    $.ajax({
        type: 'POST',
        url: 'addVideo',
        data: {
            video_title: title,
            playlist_name: playlist,
            url: id
            // csrfmiddlewaretoken: '{{ csrf_token }}',
        },
        done: notify('success', 'video saved successfully'),
        fail: notify('error', 'There were some errors while saving the video. Please try in a while')
    });

notify looks like

function notify(notify_type, msg) {
    var alerts = $('#alerts');
    alerts.addClass('alert');
    alerts.append('<a class="close" data-dismiss="alert" href="#">×</a>');
    if (notify_type == 'success') {
      alerts.addClass('alerts-success').append(msg).fadeIn('fast');
    }
    if (notify_type == 'failure') {
      alerts.addClass('alerts-error').append(msg).fadeIn('fast');
    }
}
  • When I save click on button I get success message as

video saved successfully x(cross mark)

  • I click cross and notification is gone now
  • When I AGAIN save click on button, nothing happens, I see firebug complaining
    No elements were found with the selector: "#alerts"

  • My guess is clicking on cross mark removes the div="alerts" tag entirely from DOM. is it correct?

Question
– How can I get the correct behavior. clicking on cross mark removes notification div, clicking on button to create creates the notification div again

  • 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-09T04:34:12+00:00Added an answer on June 9, 2026 at 4:34 am

    Actually according to this when you click x the plugin removes the div so when you try to select the div again using var alerts = $('#alerts'); after you close it once the div is not present in the dom.

    A part of the plugin that is responsible for close/remove an element

    function removeElement() {
      $parent
        .trigger('closed')
        .remove()
    }
    
    $.support.transition && $parent.hasClass('fade') ?
      $parent.on($.support.transition.end, removeElement) :
      removeElement()
    

    Try to create a dynamic div each time (with id alerts) and append it to the body where you want to place it, it may work.

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

Sidebar

Related Questions

I would like to send data using $.ajax like this: $.ajax({'url': 'my.php', 'type': 'POST',
AJAX Call $.ajax({ url: '/api/Inventory', cache: false, type: 'POST', data: json, contentType: 'application/json, charset=utf-8',
.ajax({ type: 'POST', url: '..serverices/ajaxserver.asmx', data: 'lname='+ $('#lastname').val() }); return false; if #lastname has
I am using the following call to send data back to the server: $.ajax({
I'm writing a Google Maps app that requests data from the server using jQuery's
I'm trying to use cURL to post data to the form on this URL:
I'm trying to use cURL to post data to the form on this URL:
I have some web application that uses jQuery to send AJAX requests to server.
I have a url that looks like this: http://localhost/store/mens/category/t-shirts/item/a-t-shirt I have a class called
I have a situation where I send jquery ajax post request but in my

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.