Since you're using Ajax.updater and not Ajax.Request, you need to
supply the ID of the element you wish to update.

Typically the syntax is as follows:

new Ajax.Updater(el, url, { method: 'get' });

el = ID of the element you're updating. In your case, use something
like <input id='city'>, so use 'city' as your ID in your call

url = if you're using GET you can pass the parameter in the URL, so in
your case the URL is:

'ajax.zip_code.php?zip=' + $F('cust_zipcode');

You can add the error handing if you want to.

Giv it a try.




On Mar 24, 2:32 pm, Joey H <[EMAIL PROTECTED]> wrote:
> Hello... New to prototype... I know this is probably just really
> really simple but i have not been able to find a good tutorial
> explination or documetation explination for how to do this... I Would
> like this code to update the value of the cust_city form field...
>
> thanks in advance for the help :o)
>
> <CODE>
>
> <script type="text/javascript" src="../prototype.js"></script>
>     <script>
>                 function checkZip() {
>                 if($F('cust_zipcode').length == 5) {
>
>                         var url = 'ajax.zip_code.php';
>                         var params = 'zip=' + $F('cust_zipcode');
>
>                         var ajax = new Ajax.Updater(
>                                         {success: 'zipResult'},
>                                         url,
>                                         {method: 'post', parameters: params, 
> onFailure: reportError}
>                                 );
>
>                         }
>                 }
>
>                 function reportError(request) {
>                         $F('zipResult') = "Error";
>                 }
>     </script>
>
> ..
> ...
>
> <input name="cust_zipcode" type="text" id="cust_zipcode" tabindex="6"
> size="13" onkeyup="checkZip();" />
>
> <input name="cust_city" type="text" id="cust_city" size="35" />
>
> </
CODE>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to