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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:28:22+00:00 2026-06-15T23:28:22+00:00

i have a form ,if i submit it then i want the success message

  • 0

i have a form ,if i submit it then i want the success message to be print from my json response in the same page.

I am getting many values from the json response but i only want the variable called as “message” which i have define in my java action.

The formated json response is like this

       `{"errmsg":null,"jsonModel":null,"message":"Succussfuyly completed the task","model":
        {"createdDate":null,"createrId":null,"id":null,"themeCaption":null,"themeName":null,
        "themeScreenshot":null,"updateId":null,"updatedDate":null},"oper":null,"theme":{"createdDate":null,
        "createrId":null,"id":null,"themeCaption":null,"themeName":null,"themeScreenshot":null,
        "updateId":null,"updatedDate":null},"themeScreenshot":null}`

From this response i want only the message variable to be printed in my jsp page.
From my below jquery code ,all the value is printing in my jsp page. But i want only messsage variable.

index.jsp

  <script type="text/javascript">
    $(document).ready( function() {
        $.subscribe('handleJsonResult', function(event,data) {
            $('#result').html("<div id='languagesList'> <s:property value="Message"/> </div>"+'' + data.Message + '');
            var list = $('#languagesList');
                    $.each(event.originalEvent.data, function(index, value) { 
                            list.append('<h1>'+value+'</h1>\n');
                    });
        });
    });    
        </script>  
        </head>
        <body>

     <img id="indicator" src="${pageContext.request.contextPath}/images/others/ajax-loader.gif" alt="Loading..." style="display:none"/>
    <s:form action="updatethemeimageform" method="post" enctype="multipart/form-data" id="remoteform"  theme="simple" > 
               <s:hidden value="%{#parameters.themeid}" name="themId"/> 
               <s:file name="themeScreenshot" label="Theme Screenshot" /> 
              <sj:a button="true" id="btnsid" buttonIcon="ui-icon-gear" dataType="json" indicator="indicator"  onSuccessTopics="handleJsonResult" 
              formIds="remoteform" targets="result"  >Submit This Form</sj:a> 
     </s:form>

         <sj:div id="result" >    
            Json Result will come here
         </sj:div>



                       `-----------
                         ---------------
                    private String Message;

           public String updateThemesImage(){ 
    setMessage("Succussfuyly completed the task"); 
    return SUCCESS;
              }
                   ------------
                    -----------
                   With getter & setters`

From my above jquery function i am geting output like this Output of my above jquery function
please help me to solve this problem

  • 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-15T23:28:23+00:00Added an answer on June 15, 2026 at 11:28 pm

    Your each loop is working correctly however if you only want several specific variables use object notation to retrieve them:

    $.subscribe('handleJsonResult', function(event, data) {
        $('#result').html("<div id='languagesList'> <s:property value="Message "/> </div>" + '' + data.Message + '');
        var list = $('#languagesList');
    
        var jsonData = event.originalEvent.data;
            /* example retrieving ID and message*/
        list.append('<h1>ID:' + jsonData.id + ', Message:' + jsonData.message +'</h1>\n');
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: jQuery AJAX submit form I have a form on a page A,
I have a form which on submit I want to run a script via
I have a form, when user submit the form, I want to direct the
I got a form that I submit and then Id like to have the
When I submit my form, the last function I have is: $(#message).show().delay(5000).fadeOut(); This will
I have a situation where I needed to get data from a form submit().
I have a form, user enters some data then submits. Rather than a popup
I have this form submit code: Event.observe(window, 'load', init, false); function init() { Event.observe('addressForm',
I am trying to have my form fields submit after the onchange event. The
I have a form where the submit button triggers a function. Let's call it

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.