[Facebooker-talk] Trouble with link_to_remote in Facebooker

Bryan bdondo at gmail.com
Mon Aug 11 17:01:14 EDT 2008


Thanks Ken. That works.. except I changed :success to :complete to get it to
update my div with the new html.

On Mon, Aug 11, 2008 at 11:26 AM, Ken Schroeder <schroeder.ken at gmail.com>wrote:

> This syntax works to show page elements.
> :before => "$('post_spinner').show();", :success =>
> "$('post_spinner').hide();"
>
> On Mon, Aug 11, 2008 at 2:23 PM, Bryan <bdondo at gmail.com> wrote:
>
>> This has led me to another question.. how do I get the :loading param to
>> work with link_to_remote? That is, when the user clicks on the link, I want
>> it to replace the div with "Updating..." while it's updating.  Right now I
>> have this in my view:
>>
>> <p>Ajax test - link_to_remote</p>
>> <%=link_to_remote('update it',
>>   :update => 'foo',
>>   :loading => "fb_replace_with_busy('foo')",
>>   :url => info_ajax_update_url(:canvas => false)
>> ) %>
>>
>> <div id='foo'>Original Text</div>
>>
>> and in my application.js file, which I include after including
>> facebooker.js, I have:
>>
>> function fb_replace_with_busy(div_id) {
>>   $(div_id).setTextValue("Updating...");
>> }
>>
>> (I also tried setInnerXHTML but that didn't work either).
>>
>> I don't see any errors in Firebug..
>>
>> Thanks,
>> Bryan
>>
>>
>> On Mon, Aug 11, 2008 at 10:03 AM, Bryan <bdondo at gmail.com> wrote:
>>
>>> David Clements helped a ton by pointing out that I didn't have the
>>> protect_from_forgery call in my application controller.  Everything works
>>> great now...
>>>
>>> Thanks Dave!
>>>
>>> Bryan
>>>
>>>
>>> On Mon, Aug 11, 2008 at 8:56 AM, Bryan <bdondo at gmail.com> wrote:
>>>
>>>> Hi, I'm trying to update a div with ajax using link_to_remote, but can't
>>>> seem to get it working.  I can get form_remote_tag to work just fine though.
>>>>
>>>>
>>>> My InfoController (it's not a RESTful controller) simply has:
>>>>
>>>>   def update_ajax
>>>>     render :text => 'new text'
>>>>   end
>>>>
>>>> And my view has:
>>>>
>>>> <p>Ajax test - link_to_remote</p>
>>>> <%=link_to_remote('update it',
>>>>   :update => 'foo',
>>>>   :url => info_ajax_update_url(:canvas => false)
>>>> ) %>
>>>> <br/>
>>>>
>>>> <p>Ajax test 2 - form_remote_tag </p>
>>>> <% form_remote_tag  :url => info_ajax_update_url(:canvas=> false),
>>>> :update=>"foo" do |f|%>
>>>> <%= submit_tag 'Update' %>
>>>> <% end %>
>>>>
>>>> <div id='foo'>
>>>>   Original text
>>>> </div
>>>>
>>>> In my routes I have:
>>>>
>>>> map.info_ajax_update 'info/update_ajax', :controller => 'info', :action
>>>> => 'update_ajax'
>>>>
>>>> (if the above looks garbled, I've put it up on pastie as well:
>>>> http://pastie.textmate.org/250092 )
>>>>
>>>> Firebug gives me this error: a5279184xxx_options[idx("parameters")] is
>>>> undefined
>>>>
>>>> Any ideas?  Anyone have an example of working link_to_remote usage?  I
>>>> searched this mailing list but didn't find anything that works for me.
>>>>
>>>> Thanks,
>>>> Bryan
>>>>
>>>
>>>
>>
>> _______________________________________________
>> Facebooker-talk mailing list
>> Facebooker-talk at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/facebooker-talk
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20080811/79b4f437/attachment-0001.html>


More information about the Facebooker-talk mailing list