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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:55:20+00:00 2026-05-26T12:55:20+00:00

I have 2 functions, submit() with $.ajax and click() with $.post . In the

  • 0

I have 2 functions, submit() with $.ajax and click() with $.post. In the function with $.ajax I use ajaxStart() and ajaxStop(), but at $.post no. Example:

In submit:

$(document).ready(function(){

    $('#myform').submit(function() {

            $(this).ajaxStart(function() {
                    $('.notice').html('Send...');
                    $('#send').attr('disabled', 'disabled');
            });

            $(this).ajaxComplete(function() {
                    $('#send').removeAttr('disabled');
            });

            $.ajax({   
                  type: "POST",   
                  url: 'server01.php',   
                  data: $(this).serialize(),   
                  success: function(data) {   
                        switch(data){
                            case 'success':
                                $('.notice').html('Good!');
                                setTimeout("location.reload();",3000);
                                break;
                            default:
                                $('.notice').html('Error');
                                break;
                        }  
                  } });
    return false; 
    });

});

In click:

$(function() {

    $('#language').click( function() {
            $.post("language.php", { language: $(this).attr('class') } )
            .success(function(data) { location.reload(); })
            .error(function() { alert("error"); });
            return false;
    });

});

The problem is that when I run the click() function activates the ajaxStart() method on submit event.

There is a possibility to disable ajaxStart() or not to run when I use the click function?

  • 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-26T12:55:20+00:00Added an answer on May 26, 2026 at 12:55 pm

    I don’t think there is a possibility to disable ajaxStart(), because it works globally for the whole code.

    but if you want to isolate what you coded for your myform element, you can do something like this :

    $('#myform').submit(function() {
    
                $('.notice').html('Send...');
                $('#send').attr('disabled', 'disabled');
    
                $.ajax({   
                      type: "POST",   
                      url: 'server01.php',   
                      data: $(this).serialize(),   
                      success: function(data) {   
                            switch(data){
                                case 'success':
                                    $('.notice').html('Good!');
                                    setTimeout("location.reload();",3000);
                                    break;
                                default:
                                    $('.notice').html('Error');
                                    break;
                            }  
                      },
                      complete : function() {
                          $('#send').removeAttr('disabled');
                      }
                     });
        return false; 
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two ajax functions and use the first one to pass some data
i have problems with ajax requests and simple <input type=submit/> . i use to
I have a form with a submit button. I have called a function on
I have this code: function submitTwice(f){ f.action = 'http://mydomain.com/threevideopage.php'; f.target='name'; f.submit(); } I left
I have the following code: <script type=text/javascript> function SubmitForm() { form1.submit(); } function ShowResponse()
I have this form submit code: Event.observe(window, 'load', init, false); function init() { Event.observe('addressForm',
i have the following block of code: $(#contact_container form, #contact_details form).live( submit, function(event) {
in writing a scripting engine, I have functions like (psuedo-code) function is_whitespace?(char c){ return
I have a page that I use AJAX to save some data in a
i have a newsletter form i use on my site using ajax with jquery.

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.