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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:32:01+00:00 2026-05-26T10:32:01+00:00

I have this configuration in struts.xml <action name=updateAction class=it.myApp.action.ajax.UpdateActionAction> <result name=success type=json/> <result name=error

  • 0

I have this configuration in struts.xml

<action name="updateAction"
    class="it.myApp.action.ajax.UpdateActionAction">
<result name="success" type="json"/>
<result name="error" type="json"/>
</action>

this is my Action class

...
try{
    act.update();
}catch(Exception e){
    Logger.print(MessageType.ERROR,"Update failed "+e.getMessage());
    return ForwardResult.ERROR;
}
return ForwardResult.SUCCESS;

at last, this is jQuery ajax function

$.ajax({
    url: 'updateAction.action',
    traditional:true,
    data : {
        'actionId': id,
        'actionName': name,
        'actionDescr':descr
    },
    success: function(data) {
        $('#act_'+id).html(data.name);
        $('#des_'+id).html(data.descr);
        $('#update_'+id).html(data.update);
        $('#userId_'+id).html(data.userId);

        $('#mdf_'+id).css("display","block");
        $('#save_'+id).css("display","none");   
        $('#diag_'+id).html(data.result);
    },
    error: function(data){
        alert("AZZ!");
        $('#diag_'+id).html(data.result);
    }
}); 

when action updates data with success, there aren’t problems, ajax function executes “success” statement, but when action throws an exception, ajax doesn’t execute “error” statement but “success” again…

why?

thanks advance

M.

  • 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-26T10:32:02+00:00Added an answer on May 26, 2026 at 10:32 am

    Because the request didn’t generate an error, where “error” means the server returns an HTTP error code. The server response may indicate an error in a different way, e.g., an error property.

    You can check the response code and contents using Firebug or something similar; if you’re expecting something other than what it sends back, add some details to the question stating what it returns, and what you’d like to see instead.

    The easiest option is to set the statusCode or errorCode of the result as detailed in the JSON plugin docs. (Assuming that’s the JSON plugin you’re using.)

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

Sidebar

Related Questions

Hey I have this configuration in my web.config <log4net> <appender name=LogFileAppender type=log4net.Appender.FileAppender> <param name=File
So I have this code inside my lib/ folder: class GlobalConfig::SetHelper def self.yes_no_input(configuration) value
I have this configuration in ibatis-config.xml <configuration> <properties resource=collector.properties/> <environments default=development> <environment id=development> <transactionManager
I have this configuration for ehCache: <ehcache> <defaultCache name=defaut maxElementsInMemory=5 eternal=false timeToIdleSeconds=20 timeToLiveSeconds=20 overflowToDisk=false
I have this configuration for my application. <application android:label=@string/app_name android:theme=@android:style/Theme.Holo.Light> <activity android:name=.MainActivity android:label=@string/app_name> I
I have this configuration in my web.config. <siteMap defaultProvider=Provider1 enabled=true> <providers> <add name=Provider1 siteMapFile=Web.sitemap
I have this code: public class Configuration{ public Control container; public Configuration() { container
At the moment I have this configuration: build.xml: <!-- Ivy settings start--> <condition property=ivy.home
In my DefaultRegistry I have this configuration: ForRequestedType<INHUnitOfWork>().CacheBy(InstanceScope.HttpContext) .TheDefault.Is.OfConcreteType<NHibernateUnitOfWork>(); At some point in the
I have this Perl script with many defined constants of configuration files. For example:

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.