diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2011-09-16 22:12:41 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2011-09-16 23:22:50 +0530 |
commit | 27f1320fde03279c575693f504897f1a6171bc59 (patch) | |
tree | 0385edc63d63eeee990e036aba19217cb01c55c5 /railties/guides/source/ajax_on_rails.textile | |
parent | 8411f631c42de7d6f51d10d997b037b9eff0d1f1 (diff) | |
download | rails-27f1320fde03279c575693f504897f1a6171bc59.tar.gz rails-27f1320fde03279c575693f504897f1a6171bc59.tar.bz2 rails-27f1320fde03279c575693f504897f1a6171bc59.zip |
Fixing incorrect notextile tags
Diffstat (limited to 'railties/guides/source/ajax_on_rails.textile')
-rw-r--r-- | railties/guides/source/ajax_on_rails.textile | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/railties/guides/source/ajax_on_rails.textile b/railties/guides/source/ajax_on_rails.textile index 77f7661deb..29d4fae888 100644 --- a/railties/guides/source/ajax_on_rails.textile +++ b/railties/guides/source/ajax_on_rails.textile @@ -104,7 +104,7 @@ Note that if we wouldn't override the default behavior (POST), the above snippet link_to_remote "Update record", :url => record_url(record), :method => :put, - :with => "'status=' + 'encodeURIComponent($('status').value) + '&completed=' + $('completed')" + :with => "'status=' <plus> 'encodeURIComponent($('status').value) <plus> '&completed=' <plus> $('completed')" </ruby> This generates a remote link which adds 2 parameters to the standard URL generated by Rails, taken from the page (contained in the elements matched by the 'status' and 'completed' DOM id). @@ -124,6 +124,7 @@ link_to_remote "Add new item", 404 => "alert('Item not found!')" </ruby> Let's see a typical example for the most frequent callbacks, +:success+, +:failure+ and +:complete+ in action: + <ruby> link_to_remote "Add new item", :url => items_url, @@ -133,6 +134,7 @@ link_to_remote "Add new item", :success => "display_item_added(request)", :failure => "display_error(request)" </ruby> + ** *:type* If you want to fire a synchronous request for some obscure reason (blocking the browser while the request is processed and doesn't return a status code), you can use the +:type+ option with the value of +:synchronous+. * Finally, using the +html_options+ parameter you can add HTML attributes to the generated tag. It works like the same parameter of the +link_to+ helper. There are interesting side effects for the +href+ and +onclick+ parameters though: ** If you specify the +href+ parameter, the AJAX link will degrade gracefully, i.e. the link will point to the URL even if JavaScript is disabled in the client browser |