# AJAX page.call not working

**URL:** <https://www.ruby-forum.com/t/ajax-page-call-not-working/152335>\
**Category:** Rails\
**Created:** [November 2, 2008, 4:14pm UTC](https://www.ruby-forum.com/t/ajax-page-call-not-working/152335 "2008-11-02T16:14:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajatgarg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a183cd/32.png) [@rajatgarg](https://www.ruby-forum.com/u/rajatgarg)\
**Post date:** [November 2, 2008, 4:14pm UTC](https://www.ruby-forum.com/t/ajax-page-call-not-working/152335/1 "2008-11-02T16:14:56Z")

</div>

Hi Everyone,

I need your help.

I have created a form that makes an Ajax call to submit the data.

It is working fine on 1 page of the site  
([Contact | Trip Outlook Travel Buddy](http://www.tripoutlook.com/home/contact)) and same code is not working  
properly at the other page ([http://www.tripoutlook.com/home/publishers](http://www.tripoutlook.com/home/publishers))

It seems like page.call function is not getting handled properly i.e.

on successful form submission, controller does the following -  
render :update do |page|  
page \<\< “$(‘contact\_us\_table’).hide();”  
page \<\< “$(‘contact\_status’).show();”  
end

which should hide the contact form and display a message.

Instead, for [http://www.tripoutlook.com/home/publishers](http://www.tripoutlook.com/home/publishers), it just dumps  
the following -  
page \<\< “$(‘contact\_us\_table’).hide();”  
page \<\< “$(‘contact\_status’).show();”

How can I fix this?

---

<div class="post-metadata">

**Author:** ![rajatgarg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a183cd/32.png) [@rajatgarg](https://www.ruby-forum.com/u/rajatgarg)\
**Post date:** [November 2, 2008, 7:56pm UTC](https://www.ruby-forum.com/t/ajax-page-call-not-working/152335/2 "2008-11-02T19:56:55Z")

</div>

Rajat G. wrote:

> ```
> page << "$('contact_us_table').hide();"
> 
> ```
> 
> How can I fix this?

I’d say you have to change your submit onclick handler  
to call this.form.onsubmit() instead of this.form.submit().

Perhaps instead of a remote\_form and a normal submit button  
you should use a normal form and a submit\_to\_remote button  
with onclick JS “this.disabled=true;this.value=‘Sending…’”

–  
Rails Wheels - Find Plugins, List & Sell Plugins -  
[http://railswheels.com](http://railswheels.com)
