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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:45:51+00:00 2026-05-26T05:45:51+00:00

I am having problem with jquery that the ajax call is not made. Also

  • 0

I am having problem with jquery that the ajax call is not made.
Also the click should not get at the top of dom to trigger the hide af the .warning div.

I can see with firebug that the POST request is not made.

Here is my jquery:

$(document).click(function(e) {
    if($('.warning').hasClass("active"))
        $('.warning').hide();
});

$('.ero').click(function(e) {
    e.stopPropagation();
    e.preventDefault();
            $.ajax({
        type: 'POST',
        url: '/stem_op/3',
        data: {id: idv},
        success:function(msg){
        $('.warning').fadeIn(500).css({
        display: 'block',
        position: 'absolute',
        left: position.left + 50,
        top: position.top - 25
    }).append(msg).addClass("active")}
        });      
});
  • 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-26T05:45:51+00:00Added an answer on May 26, 2026 at 5:45 am

    Yeah, based on your code if it’s included in the head the ero classed element doesn’t exist yet. Without the .ready() your code is executing immediately. Since you’re using .click() as opposed to a delegate, there’s nothing to bind to when it’s executed.

    Like Dyer above says, wrap it in a ready:

    $(document).ready(function() {
       //code goes here
    });
    

    If you are possibly going to have an .ero element added dynamically with JS based on user interaction, you’ll want to make use of delegate.

    Also, .click() is essentially a shortcut to bind() so try and start using that at least so you can namespace your events as well. That makes binding, unbinding, and rebinding event handlers extremely easy without impacting other code that may be using the same events on that element.

    //instead of
    $(".ero").click(function(e) { });
    
    //something like this
    $(".ero").bind("click.mynamespace", function(e) {
        //code here
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem when using the jquery .each() and .ajax() functions together. I'm
I'm having trouble getting a response back from a Jquery ajax call... (It's a
I am having a webmethod that returns some data.I'm using jquery to call that
I'm having some issues with a jQuery AJAX call. My code works fine when
I'm having some trouble with an Ajax script which disables my jQuery click events.
I'm having a little problem with jQuery ajax and an animation. I have a
I am using jQuery to call a php page (via ajax) that goes to
I'm trying to use this amazing plugin: http://code.drewwilson.com/entry/autosuggest-jquery-plugin The problem I'm having is that
I'm having this problem with my AJAX, where it's not working in IE, but
I'm having a little problem with jQuery: I'm having .submit() defined on a form,

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.