Hi Bhavin, Why you are defining "/saveTemplate.htm?dispatch=save" in the action parameter of your form whereas you have already the saveData action defined in the click handler? Would you please delete the "action="/saveTemplate.htm?dispatch=save"" from your JSP page and let only the click handle do its work. Thanks to let us know what it gives you as result?
Regads, PS: Struts2 is much smart regarding Ajax, you can try to use it instead version 1. -- Youssef ELALAOUI JCargoo Founder www.jcargoo.org Pensez à l'environnement avant d'imprimer ce message / Think of the environment before printing out this message On Wed, Nov 19, 2008 at 1:35 AM, Bhavin <[EMAIL PROTECTED]> wrote: > > Hi, > > I am using JQuery with Struts 1.1. I am using following code when > user > clicks on Save button: > > > $('#save').click(function() { > $.blockUI({ message: "<h1>Please wait...</h1>" }); > > > $.ajax({ > url: '/saveData.do?dispatch=save', > type:'post', > cache: false, > dataType:'xml', > complete: function() { > $.unblockUI(); > } > }); > > > Following is my struts code: > > > <body onload=""> > <html:form action="/saveTemplate.htm?dispatch=save" > method="POST"> > <div id="firstchildcontainer"> > Name: <html:text property="templateName"/> > Description: <html:textarea property="description" > rows="8" > cols="10"/> > <html:submit styleId="save"><bean:message > key="button.save"/></ > html:submit> > <html:cancel styleId="cancel"><bean:message > key="button.cancel"/></ > html:cancel> > </div> > </html:form> > </body> > > > The problem here is it is submitting request twice because it is > defined with struts form and with url (in ajax). How can I avoid > duplicate request? > > I tried return false in click event but then actionform is not > populated from jsp fields. > > Can anyone give working example of Jquery + Struts 1 ? > > Thanks, > Bhavin > > >