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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:21:34+00:00 2026-05-20T17:21:34+00:00

I have a form created using Ajax.BeginForm() <% using (Ajax.BeginForm(UpdateCompanyShop, CompanyShop, FormMethod.Post, new AjaxOptions

  • 0

I have a form created using Ajax.BeginForm()

<% using (Ajax.BeginForm("UpdateCompanyShop", "CompanyShop", FormMethod.Post, 
    new AjaxOptions { OnSuccess = "updateList", OnFailure = "onError",
    UpdateTargetId="slist", LoadingElementId = "loading" }))

controller action code is like below:

if(string.IsNullOrEmpty(company.Address))  
    return new HttpStatusCodeResult(418, "Please fill in address");  
else if (company.DistrictID < 0)  
    return new HttpStatusCodeResult(418, "Please select district");  
else  
    return new HttpStatusCodeResult(418, "Error saving data");

I used OnFailure=”onError” in AjaxOptions and I have my client-side script like this

function onError(response, status, error) {  
    var statusDescription = ***something***;  
    alert(statusDescription);
}

I use debugger in the JavaScript but cannot find the StatusDescription (the 2nd parameter in HttpStatusCodeResult)

Any idea how I can get status description? Or I should not use HttpStatusCodeResult at all? What is the proper way to return error (apart from validation) in AJAX submit?

  • 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-20T17:21:35+00:00Added an answer on May 20, 2026 at 5:21 pm

    Use response.statusText:

    function onError(response, status, error) {
        alert("Oops! " + response.statusText);
    }
    

    I wrote a post that provides somewhat more detail and a couple of examples:
    Dealing with javascript or JSON results after an AJAX call with Ajax.ActionLink, unobtrusive AJAX and MVC 3

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

Sidebar

Related Questions

I have a simple form created using Ajax.BeginForm : <% using (Ajax.BeginForm(Update, Description, new
I have an ajax.beginform() like this : @using (Ajax.BeginForm(Create_Product, Admin, new AjaxOptions() { OnFailure
i have view which looks something like this : <% using (Ajax.BeginForm(new AjaxOptions {
I have an ajax form created with the html helper: @using (Ajax.BeginForm(...)) The problem
I am new to symfony. I have created a registration form using the code:
I have the following form in a partial view @model PartDetail @using (Ajax.BeginForm(Create, Part,
I have created an form validation using ajax/php. Each text box is validated using
I have the following code in a partial view: @model MyOrganization.MyApp.Models.ProductListing @using (Ajax.BeginForm(TagProduct, new
I created a form using Swing in Java. In the form I have used
Im using c# .net windows form application. I have many databases created using sql

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.