On 9 Sep 2008, at 02:42, David wrote:

>
> Yea, I am trying to just use the link_to_remote helper now, but aside
> from converting the array and using JSON, I can't even get the
> link_to_remote to route now.  I am using:
>
> <%= link_to_remote 'Click me', :url => {:action => "update"}, :with
> => 'test' %>
>
> and the only action that works successfully is the new action, so
>
> <%= link_to_remote 'Click me', :url => {:action => "new"}, :with =>
> 'test' %>
>
> routes successfully, but this is not what i want.  I get this error in
> firebug:
>
> POST http://localhost:3000/appointments/update500 241ms.
>
I assume that's telling you that the server returned a 500 error,  
which means check your logs.

Fred
> Do you have any idea why this is happening?
>
> On Sep 8, 6:30 pm, Frederick Cheung <[EMAIL PROTECTED]>
> wrote:
>> On 8 Sep 2008, at 22:54, David wrote:
>>
>>
>>
>>> Sorry, that ajax.request method should be a put, so:
>>
>>> new Ajax.Request('/appointments/array/',
>>> {method:'post',postBody:"'data='+myArray.toJSON"});
>>
>> If you're just posting json then you shouldn't that data= (and you
>> look like you're writing a link_to_remote :with option - right now
>> you're posting the string "'data='+myArray.toJSON")
>>
>> something like
>>
>> postBody: Object.toJSON(myArray)
>>
>> is more like it. You might also need to set the content-type header
>> appropriately.
>>
>> Fred
>>
>>> On Sep 8, 2:52 pm, David <[EMAIL PROTECTED]> wrote:
>>>> Hey can anyone help me convert a javascript array into a ruby  
>>>> array.
>>>> Ive been struggling with this since friday to no avail.  This is  
>>>> the
>>>> function with the ajax.request call that is supposed to convert the
>>>> array using JSON, but I keep getting a 422(Unprocessable Entity)
>>>> error.  Im not sure what is wrong.
>>
>>>>         function test()
>>>>         {
>>>>                 for(i=1;i<22;i++){
>>>>                     if (document.getElementById(i+'d').className ==
>>>> "selected"){
>>>>                         myArray.push(i);
>>>>                     }
>>>>                 }
>>
>>>>  new Ajax.Request('/appointments/array/',
>>>> {method:'get',postBody:"'data='+myArray.toJSON"});
>>
>>>>          }
>>
>>>> Thanks for any input!
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to