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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:38:22+00:00 2026-05-15T10:38:22+00:00

I use jquery to post to an MVC controller action that returns a table

  • 0

I use jquery to post to an MVC controller action that returns a table of information. The user of the page triggers this by clicking on various links.

In the event the user decides to click a bunch of these links in quick succession I wanted to cancel any previous ajax request that may not have finished.

I’ve found that when I do this (although its fine from the client’s POV) I will get errors on the web application saying that

"The parameters dictionary contains a null entry for parameter srtCol of non-nullable type 'System.Int32'"

Now the ajax post deffinately passes in all the parameters, and if I don’t try and cancel the ajax request it works just fine.

But if I do cancel the request by calling abort() on the XMLHttpRequest object that ajax() returns before it finishes I get the error from ASP.Net MVC.

Example:

//Cancel any pevious request
if (req)
{
    req.abort();
    req = null;
}

//Make new request
req = $.ajax({
    type: 'POST',
    url: "/Myapp/GetTbl",
    data: {srtCol: srt, view: viewID},
    success: OnSuccess,
    error: OnError,
    dataType: "html"
});

I’ve noticed this only happen is IE8. In FF it seems to not cuase a problem.

Does anyone know how to cancel an ajax request in IE8 without causing errors for MVC?

Thanks for any help.

  • 1 1 Answer
  • 1 View
  • 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-15T10:38:22+00:00Added an answer on May 15, 2026 at 10:38 am

    IE might be sending part of the request body to the server before aborting, giving the server enough request to start processing, but not all the parameters it needs. You could check this by looking at IE’s activity in a proxy (like fiddler)—if you get part of the request, then IE is handling the abort() badly. If that’s the case, you may want to let the old AJAX request finish, and just prevent its OnSuccess from doing anything, rather than aborting it.

    EDIT:

    var req; // current/latest request
    
    var OnSuccess = function(data, textStatus, XMLHttpRequest) {
        if (XMLHttpRequest != req) return;
        // latest request has succeeded
    }
    
    req = $.ajax(...);
    

    Keep a reference to the latest request, as you do now, but don’t abort it. Instead, OnSuccess checks if the request object passed to it is the same as the “latest request”; if they’re different, another request has intervened, and it passes.

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

Sidebar

Related Questions

I'm attempting to use jQuery to do a $.post() to an MVC controller action.
When i use jquery's $.post ajax function, page freezes for 2-3 seconds and then
I'm trying to use jquery.Ajax to post data to an ASP.NET MVC2 action method
We have a ASP.NET MVC 3 application that uses unobtrusive jQuery validation. The page
I'm attempting to use jQuery's $.ajax() function to post form variables to an MVC
I have a form in my ASP.NET MVC 3 application that will use jquery
I have an on my MVC View page. I use JQuery to filter a
I am writing application with asp.net mvc. I have controller with action, which use
I use jquery post function to go to server and bring the link to
I have a standard form in mvc4 operation. I use jQuery.post to perform postback

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.