# Ajax makes me cry

**URL:** <https://www.ruby-forum.com/t/ajax-makes-me-cry/51602>\
**Category:** Rails\
**Created:** [January 4, 2006, 3:42am UTC](https://www.ruby-forum.com/t/ajax-makes-me-cry/51602 "2006-01-04T03:42:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjrussell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jjrussell](https://www.ruby-forum.com/u/jjrussell)\
**Post date:** [January 4, 2006, 3:42am UTC](https://www.ruby-forum.com/t/ajax-makes-me-cry/51602/1 "2006-01-04T03:42:02Z")

</div>

What is the difference in treatment between an ajax link\_to\_remote and a  
form\_remote\_tag

This works great and adds a list item to an ordered list with  
id=form\_results

link\_to\_remote (“Help me please!”,  
:update =\> ‘form\_results’,  
:url =\> { :action =\> :search\_ajax\_test },  
:position =\> ‘bottom’)

with this log message

Processing AdminController#search\_ajax\_test (for 192.168.15.100 at  
2006-01-03 21:35:43) [POST]  
Parameters: {“action”=\>“search\_ajax\_test”, “controller”=\>“admin”}  
Completed in 0.00079 (1272 reqs/sec) | DB: 0.00000 (0%) | 200 OK  
[[http://192.168.15.50/admin/search\_ajax\_test](http://192.168.15.50/admin/search_ajax_test)]

This does absolutely nothing at all

form\_remote\_tag ( :udpate =\> ‘form\_results’,  
:url =\> { :action =\> :search\_ajax\_test },  
:position =\> ‘bottom’)  
…some stuff…  
end\_form\_tag

but still produces this log message

Processing AdminController#search\_ajax\_test (for 192.168.15.100 at  
2006-01-03 21:35:46) [POST]  
Parameters: {“commit”=\>“Search”, “action”=\>“search\_ajax\_test”,  
“controller”=\>“admin”, “query”=\>“asdf”}  
Completed in 0.00077 (1291 reqs/sec) | DB: 0.00000 (0%) | 200 OK  
[[http://192.168.15.50/admin/search\_ajax\_test](http://192.168.15.50/admin/search_ajax_test)]

Can anyone tell me why the form call does nothing at all?

Thanks

---

<div class="post-metadata">

**Author:** ![jjrussell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jjrussell](https://www.ruby-forum.com/u/jjrussell)\
**Post date:** [January 4, 2006, 5:07am UTC](https://www.ruby-forum.com/t/ajax-makes-me-cry/51602/2 "2006-01-04T05:07:39Z")

</div>

On 1/4/06, John R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> What is the difference in treatment between an ajax link\_to\_remote and a  
> form\_remote\_tag

The former generates a tag and the latter generates a which  
sends  
post data asynchronously after serializing it in url encoded  
form.Bothreturn html which is inserted into the html noe whose id is  
in :update

 

> but still produces this log message
> 
> Thanks

 

It would be better if you post the generated html because the code in  
your  
view looks ok.Besides are actually returning any html in your controller  
action? is there a call to a render ? Whatever is returned by render  
will  
be inserted into the ‘form\_results’ node.  
Vivek

 

–

---

<div class="post-metadata">

**Author:** ![jjrussell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jjrussell](https://www.ruby-forum.com/u/jjrussell)\
**Post date:** [January 4, 2006, 5:25am UTC](https://www.ruby-forum.com/t/ajax-makes-me-cry/51602/3 "2006-01-04T05:25:24Z")

</div>

John R. wrote:

> form\_remote\_tag ( :udpate =\> ‘form\_results’,  
> Thanks

update, not udpate, lol.

---

<div class="post-metadata">

**Author:** ![jjrussell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jjrussell](https://www.ruby-forum.com/u/jjrussell)\
**Post date:** [January 4, 2006, 1:07pm UTC](https://www.ruby-forum.com/t/ajax-makes-me-cry/51602/4 "2006-01-04T13:07:21Z")

</div>

Ben H. wrote:

> > form\_remote\_tag ( :udpate =\> ‘form\_results’,  
> > Thanks
> 
> update, not udpate, lol.

AAAAAAAAAAAHHHHHHHHHHHHHHHHH!!!

You are my hero. Thank you so much.

---

<div class="post-metadata">

**Author:** ![jjrussell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jjrussell](https://www.ruby-forum.com/u/jjrussell)\
**Post date:** [January 4, 2006, 1:51pm UTC](https://www.ruby-forum.com/t/ajax-makes-me-cry/51602/5 "2006-01-04T13:51:59Z")

</div>

John R. wrote:

> Ben H. wrote:
> 
> > > form\_remote\_tag ( :udpate =\> ‘form\_results’,  
> > > Thanks
> > 
> > update, not udpate, lol.
> 
> AAAAAAAAAAAHHHHHHHHHHHHHHHHH!!!
> 
> You are my hero. Thank you so much.

After calming down a little bit, shouldn’t this have thrown some kind of  
error? What good is a \*remote call with no update ( or udpate )  
assigned. Is there a way to turn on strict checking or something?  
Anything more helpful than apparent success? Thanks again.

---

<div class="post-metadata">

**Author:** ![jjrussell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jjrussell](https://www.ruby-forum.com/u/jjrussell)\
**Post date:** [January 4, 2006, 2:01pm UTC](https://www.ruby-forum.com/t/ajax-makes-me-cry/51602/6 "2006-01-04T14:01:08Z")

</div>

For two situations:

1. for .rjs templates, you don’t do :update
2. if you handle the data return somehow yourself, with a :complete  
=\> ‘…’ JavaScript callback

-Thomas

Am 04.01.2006 um 13:51 schrieb John R.:

---

<div class="post-metadata">

**Author:** ![jjrussell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jjrussell](https://www.ruby-forum.com/u/jjrussell)\
**Post date:** [January 4, 2006, 6:13pm UTC](https://www.ruby-forum.com/t/ajax-makes-me-cry/51602/7 "2006-01-04T18:13:57Z")

</div>

On 1/4/06, John R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Ben H. wrote:
> 
> > > form\_remote\_tag ( :udpate =\> ‘form\_results’,  
> > > Thanks
> > 
> > update, not udpate, lol.
> 
> AAAAAAAAAAAHHHHHHHHHHHHHHHHH!!!

ooops…missed that!! this uses the named parameter syntax of ruby and  
not  
the hash way of passing params…so it should give an error…or probably  
ruby ignores it ?
