how to exclude particular ajax call from ajaxComplete event listener

chandu

Currently, we are using ajaxComplete listener which is calling specific function which I mentioned after every ajax call happened.

$(document).ajaxComplete(function () {

    someFunction();
})

There is one scenario that after specific ajax call,I want to do something instead of calling someFunction().

Is there a way to exclude a specifc ajax call from ajaxComplete?

Akhilesh Sharma

Here is small example how you can use the settings argument in the $.ajaxComplete

$.ajax({    
type:"GET",
url:"http://google.com"
});

$.ajax({
    type:"GET",
    url:"https://stackoverflow.com"
});

$(document).ajaxComplete(function(event,xhr,settings){
    console.log("URL",settings.url);
    if(settings.url === "https://stackoverflow.com")
    {
        $(".loadedPage").html("Stackoverflow loaded");
    }
    else if(settings.url === "http://google.com")
    {
        $(".loadedPage").html("Google Loaded");
    }
});

Hope this helps!!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Exclude Button From Event Listener OnClick

From Dev

how to get particular key value from all the objects in a AJAX call

From Dev

Gradle: How to exclude a particular package from a jar?

From Dev

Javascript - Add Event Listener to live <a> tags but exclude the inside elements from the Event Listener

From Dev

Remove a particular event listener in EmberJS

From Dev

How to exclude ajax from htaccess?

From Dev

How to trigger and wait for the result of a notification from a call back function of an event listener

From Java

How to remove an event listener from window?

From Dev

How to exclude particular row id from query results?

From Dev

Attach event to elements from ajax call

From Dev

How to add a progress event listener to a prototype Ajax request?

From Dev

how to delete the particular polygon in google maps add event listener right click

From Dev

How to remove event listener?

From Dev

How to call ajax from php

From Dev

How to remove a specific event listener from a react.js element

From Dev

how to create event listener to a custom message from page script

From Dev

How to send var to view from event listener in symfony2?

From Dev

How can i remove an event listener from multiple elements in JavaScript?

From Dev

How to create event listener when message from firebase received in android?

From Dev

How to add an event listener to an action from external controller?

From Dev

How to change a Slider value from a different control event listener in JavaFX?

From Dev

how to create event listener to a custom message from page script

From Dev

How to access certain resources such as Doctrine or Request from an event listener in Symfony

From Dev

How to Exclude Child Element from jQuery Event Handler?

From Dev

How can I exclude child class from click event?

From Dev

Exclude a particular schema from code generation in JOOQ

From Dev

Exclude a particular schema from code generation in JOOQ

From Dev

How to call particular chunks from a child to a parent document using knitr?

From Dev

How to call an R function in a particular R package from Rcpp

Related Related

  1. 1

    Exclude Button From Event Listener OnClick

  2. 2

    how to get particular key value from all the objects in a AJAX call

  3. 3

    Gradle: How to exclude a particular package from a jar?

  4. 4

    Javascript - Add Event Listener to live <a> tags but exclude the inside elements from the Event Listener

  5. 5

    Remove a particular event listener in EmberJS

  6. 6

    How to exclude ajax from htaccess?

  7. 7

    How to trigger and wait for the result of a notification from a call back function of an event listener

  8. 8

    How to remove an event listener from window?

  9. 9

    How to exclude particular row id from query results?

  10. 10

    Attach event to elements from ajax call

  11. 11

    How to add a progress event listener to a prototype Ajax request?

  12. 12

    how to delete the particular polygon in google maps add event listener right click

  13. 13

    How to remove event listener?

  14. 14

    How to call ajax from php

  15. 15

    How to remove a specific event listener from a react.js element

  16. 16

    how to create event listener to a custom message from page script

  17. 17

    How to send var to view from event listener in symfony2?

  18. 18

    How can i remove an event listener from multiple elements in JavaScript?

  19. 19

    How to create event listener when message from firebase received in android?

  20. 20

    How to add an event listener to an action from external controller?

  21. 21

    How to change a Slider value from a different control event listener in JavaFX?

  22. 22

    how to create event listener to a custom message from page script

  23. 23

    How to access certain resources such as Doctrine or Request from an event listener in Symfony

  24. 24

    How to Exclude Child Element from jQuery Event Handler?

  25. 25

    How can I exclude child class from click event?

  26. 26

    Exclude a particular schema from code generation in JOOQ

  27. 27

    Exclude a particular schema from code generation in JOOQ

  28. 28

    How to call particular chunks from a child to a parent document using knitr?

  29. 29

    How to call an R function in a particular R package from Rcpp

HotTag

Archive