Sure. On Jun 2, 2009, at 9:46 AM, anthony wrote: > > I have got a working example, but now I need to add something, and I > am not sure how to do it. > > I have a function: > <script type="text/javascript" language="JavaScript"> > function getAdjForm() { > var params = Form.serialize($('createAdjForm')); > new Ajax.Updater( > "adjForm", > "/link/to/somewhere", > {method:'post', > parameters: params,
evalScripts: true > }); > } > </script> > > My HTML > <select name="adjType" id="adjType" onChange="getAdjForm()"> > .........//Lots of options listed > </select> > . > . > . > More HTML > . > . > . > <div id="adjForm"> > </div> > > This works, and my text appears inside the <div id="adjForm"> > </div>. My problem is where I have the more HTML code, I need to have > dynamic text appear there as well, but it is based on the same logic. > Is there a way to do this w/o calling a second url in my function? By adding that one variable, you open up the possibility of including inline script within /link/to/somewhere that will populate your page with the result of the calculation. <script type="text/javascript"> $('someDiv').update('result of calculation here'); </script> If you don't want your server script to be bound so much by the page layout, you can do the same thing in a onSuccess callback right in the form page, just have your server page return a blob of JSON or similar, and pick through it for your data. That is slightly less brittle, since you keep the updating and the objects you are updating within the same page. That would look something like this: function getAdjForm() { var params = Form.serialize($('createAdjForm')); new Ajax.Updater( "adjForm", "/link/to/somewhere", {method:'post', parameters: params, onSuccess: function(transport){ //do something clever here with transport.responseJSON $('someDiv').update(resultOfCleverness); } }); } Walter --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---