As of Prototype 1.5.1
there is an easier step to post form

$('fomID').request({
  method: 'get',
  parameters: { interests:'JavaScript', 'hobbies[]':['programming', 'music'] },
  onComplete: function(){ alert('Form data saved!') }
})


thanks

YUAN


On 5/10/07, -T <[EMAIL PROTECTED]> wrote:
>
> I am trying to figure out how to use Ajax with Prototype.  I see from
> http://www.sergiopereira.com/articles/prototype.js.html#UsingAjax
> there is an example for a get:
>
> var empID = $F('lstEmployees');
> var y = $F('lstYears');
> var url = 'http://yourserver/app/get_sales';
> var pars = 'empID=' + empID + '&year=' + y;
>
> var myAjax = new Ajax.Request(
>         url,
>         {
>                method: 'get',
>                parameters: pars,
>                onComplete: showResponse
>         });
>
>
>
>
> and here is an example of a post:
>
> var url = 'edit.php';
>      var pars = 'id=' + obj.id + '&content=' + new_content;
>      var myAjax = new Ajax.Request(url, {method:'post',
>           postBody:pars, onSuccess:success, onFailure:failure});
>
>
>
>
> What is the difference, it looks like the post and get use the same
> type of pars string:
>
> Post var pars = 'id=' + obj.id + '&content=' + new_content;
> Get  var pars = 'empID=' + empID + '&year=' + y;
>
> Is there any difference when passing data?
> Thank,
> -T
>
>
> >
>


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Limitless undying love
which shines around me like a million suns
It calls me on and on across the universe...."
Accross The Universe   - The Beatles -
--------------------------------------------
Visit :
http://www.sabukhitam.com/
======================

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
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