Return-Path: X-Original-To: apmail-struts-user-archive@www.apache.org Delivered-To: apmail-struts-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 409D2D6F8 for ; Mon, 30 Jul 2012 17:34:21 +0000 (UTC) Received: (qmail 33281 invoked by uid 500); 30 Jul 2012 17:34:19 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 33197 invoked by uid 500); 30 Jul 2012 17:34:19 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 33187 invoked by uid 99); 30 Jul 2012 17:34:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jul 2012 17:34:19 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [168.243.205.73] (HELO server6.sertracen.com.sv) (168.243.205.73) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jul 2012 17:34:12 +0000 Message-ID: <5016C57A.60602@ss.sertracen.com.sv> Date: Mon, 30 Jul 2012 11:33:46 -0600 From: "Ing. Alvaro Gomez" Reply-To: agomez@ss.sertracen.com.sv MIME-Version: 1.0 To: Struts Users Mailing List Subject: Re: Ajax and struts 1 References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------050803000704020301000307" X-WatchGuard-IPS: message checked X-WatchGuard-Spam-ID: str=0001.0A02020A.5016C593.005F,ss=1,fgs=0 X-WatchGuard-Spam-Score: 0, clean; 0, no virus X-WatchGuard-Mail-Client-IP: 192.168.17.5 X-WatchGuard-Mail-From: agomez@ss.sertracen.com.sv X-WatchGuard-AntiVirus: part scanned. clean action=allow --------------050803000704020301000307 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-WatchGuard-AntiVirus: part scanned. clean action=allow in user servlet in ajax in single... call servlet in action is regenerate el code in html de selection On 30/07/2012 11:19 a.m., Adriana G wrote: > I fill the select with a peersistent list than come from a method that > returns a result from the DB. > > but i don't know how to update the select without refresing the whole page, > that's why i'm trying ajax with this function, but i don't know how to use > it. > > On Mon, Jul 30, 2012 at 12:05 PM, Dave Newton wrote: > >> Define "doesn't work". >> >> What's in the response? JSON? >> >> How are you accessing the select element? I don't see anything where you >> set its ID or get it by its class name etc. >> >> What's in the JS console after your AJAX call returns? Anything? >> >> Dave >> >> On Mon, Jul 30, 2012 at 12:20 PM, Adriana G >> wrote: >> >>> Help! >>> >>> I need to refresh a select option using ajax, >>> i have this function that returns me an string list, >>> and i need to put in a select option. but it doesn't work with the >>> tag. >>> >>> I used to fill the select option with a persistent object declared in the >>> form, but i now i know how to updated taking into account the result o f >>> the ajax function. >>> Thks. >>> >>> function doAjaxPost(tipo) { >>> // get the form values >>> var name = $('#name').val(); >>> $.ajax({ >>> type: "POST", >>> url: "/fethusweb/registraPaciente.do", >>> data: "name=" + name +"&enviar="+tipo, >>> success: >>> function(response){ >>> >>> var result = response.substring(1,response.length-3); >>> var vectorResponse = result.split(","); >>> var menu= document.getElementsByClassName("menu","david"); >>> for(var i in vectorResponse){ >>> var theOption = new Option; >>> theOption.text = vectorResponse[i]; >>> theOption.value = 1; >>> menu[0].options[i]=theOption; >>> } >>> >>> }, >>> error: function(e){ >>> alert('Error: ' + e); >>> } >>> }); >>> } >>> >>> >>> -----// >>> >>> >> >>> name="registrarPacienteForm"> >>> >>> >> >>> property="ciudades"> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> -- >>> Adriii :).. >>> >>> >>> >>> -- >>> Adriii :).. >>> >> >> >> -- >> e: davelnewton@gmail.com >> m: 908-380-8699 >> s: davelnewton_skype >> t: @dave_newton >> b: Bucky Bits Blog --------------050803000704020301000307--