# What's the javascript to submit an AJAX Form?

**URL:** <https://www.ruby-forum.com/t/whats-the-javascript-to-submit-an-ajax-form/100469>\
**Category:** Rails\
**Created:** [February 2, 2006, 9:33pm UTC](https://www.ruby-forum.com/t/whats-the-javascript-to-submit-an-ajax-form/100469 "2006-02-02T21:33:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![churp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f14d63/32.png) [@churp](https://www.ruby-forum.com/u/churp)\
**Post date:** [February 2, 2006, 9:33pm UTC](https://www.ruby-forum.com/t/whats-the-javascript-to-submit-an-ajax-form/100469/1 "2006-02-02T21:33:13Z")

</div>

HI Everyone,

How do I form the href on an anchor so I can create a link-style submit  
for  
an ajax form?

In this snippet, the INPUT generated by #submit\_tag works OK, but the  
anchor  
results in the AJAX replacing the whole page?

Can I make the anchor/href submit the AJAX form as well?

Thank you!

I have this (list.rhtml):

```
<%= form_remote_tag :url => {:action=>:ajax_list_option_table},
                    :html => {:name=>'option_list_form'},
                    :update => 'option_table',
                    :complete => "Toggle.display('auto_link_link')"; 

```

%\>

# Options

| | \<%= submit\_tag "GO" %\> GO&nbsp; |

```
<%= end_form_tag -%>

```

–

---

<div class="post-metadata">

**Author:** ![churp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f14d63/32.png) [@churp](https://www.ruby-forum.com/u/churp)\
**Post date:** [February 2, 2006, 10:21pm UTC](https://www.ruby-forum.com/t/whats-the-javascript-to-submit-an-ajax-form/100469/2 "2006-02-02T22:21:35Z")

</div>

You are supposed to be able to add a :submit option, which will get the  
value of One (and only one as far as I know… I just asked about that  
myself) element (by id) in the form.

Is there any other way?

- Matt
