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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:40:07+00:00 2026-06-12T23:40:07+00:00

In My page i am sending data to server side using 8 ajax call…

  • 0

In My page i am sending data to server side using 8 ajax call…

I don’t want to handle ajax error for each and every ajax call……

Single ajax error handle all the ajax error in entire page….

is their any inheritance is possible for the entire page..

 function SendConfirmationEmail(ShipmentID, ChannelOrderReference) {
var Url = '<%=Url.Action("SendShipmentEmail","Shipments") %>';
$.ajax({
    cache: false,
    type: "POST",
    data: 'strOrderShipmentId=' + ShipmentID + '&channelOrderReference=' + ChannelOrderReference,
    url: Url,
    datatype: "HTML",
    success: function (data) {
        if (data == "1") {
            SucessErrorMessageDisplay('DivStatus', 'lblStatus', 'imgStatus', 0, 'Email is successfully sent for Order#' + ChannelOrderReference + '');
        }
        if (data == "-2") {
            SucessErrorMessageDisplay('DivStatus', 'lblStatus', 'imgStatus', 0, 'Email Template is not Choosen for this Store');
        }
        if (data == "-1") {
            SucessErrorMessageDisplay('DivStatus', 'lblStatus', 'imgStatus', 0, 'Problem in Sending Email for Order#' + ChannelOrderReference + '');
        }
        if (data == "0") {
            SucessErrorMessageDisplay('DivStatus', 'lblStatus', 'imgStatus', 0, 'Connection Failed to Send Email for Order# ' + ChannelOrderReference + '');
        }
        if (data == "-3") {
            SucessErrorMessageDisplay('DivStatus', 'lblStatus', 'imgStatus', 0, 'ShipTo Email Address is Not Given for Order# ' + ChannelOrderReference + '');
        }
        // SucessErrorMessageDisplay('DivStatus', 'lblStatus', 'imgStatus', 0, 'Order# :' + ChannelOrderReference + ' is voided successfully');

    },
    error: function (xhr, ajaxOptions, thrownError) {
        if (xhr.status == 403) {
            window.location.href = '<%: Url.Action( "SessionExpire", "Home" ) %>';
        }
    }
});

}

  • 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-12T23:40:09+00:00Added an answer on June 12, 2026 at 11:40 pm

    Hopefully I understand your question…

    When you’re calling JQuery’s ajax, you’re passing in an object with several properties. One of these properties is error. JQuery expects a function to be assigned to this property. You’re supplying an anonymous function, but there’s no reason why this can’t instead be a reference to a function.

    So you could define a function elsewhere in your script something like this:

    function handleError(xhr, ajaxOptions, thrownError) {
       if (xhr.status == 403) {
          window.location.href = '<%: Url.Action( "SessionExpire", "Home" ) %>';
       }
    }
    

    and then in your ajax calls, reference this:

    $.ajax({
        cache: false,
        // etc...
        error: handleError
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using tinymce. And I'm sending data by jquery ajax call like this //
The data I am sending my page is encoded in JSON, parsed using Javascript
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data. I am
I am sending some data from an server back to a page. It looks
Question about sending up data to my web server using HTTP via my iPhone
I'm sending data from one page to the next in an MVC2 app. Page
I am evaluating certain conditions sent by a jsp page and sending the ajax
After from processing i am sending the user on the previous page using: header('Location:
I'm sending POST data from text boxes to a PHP page for processing. Rather
I have a page that's sending some POST data in plaintext to an aspx

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.