# AJAX Problem

**URL:** <https://www.ruby-forum.com/t/ajax-problem/183746>\
**Category:** Rails\
**Created:** [February 19, 2010, 11:31am UTC](https://www.ruby-forum.com/t/ajax-problem/183746 "2010-02-19T11:31:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![manish\_belsare](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7993a0/32.png) [@manish\_belsare](https://www.ruby-forum.com/u/manish_belsare)\
**Post date:** [February 19, 2010, 11:31am UTC](https://www.ruby-forum.com/t/ajax-problem/183746/1 "2010-02-19T11:31:01Z")

</div>

“try {  
Element.hide(“add\_answer\_link\_for\_post\_-613772418”);  
Element.update(“new\_answer\_form\_for\_post\_-613772418”, “\<form  
action=”/answers” method=“post” onsubmit=“new  
Ajax.Request(’/answers’, {asynchronous:true, evalScripts:true,  
parameters:Form.serialize(this)}); return false;”\>\n\n

New Answer\n \n \n\n\n\n"); } catch (e) { alert('RJS error:\n\n' + e.toString()); alert('Element.hide(\"add\_answer\_link\_for\_post\_-613772418\"); \nElement.update(\"new\_answer\_form\_for\_post\_-613772418\", \"\\n\\n New Answer\\n \\n \\n\\n\\n\\n\");'); throw e }"

I want to eliminate this problem wen i m implementing ajax requests…  
Please help…

This is the error…Can u please guide?

---

<div class="post-metadata">

**Author:** ![manish\_belsare](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7993a0/32.png) [@manish\_belsare](https://www.ruby-forum.com/u/manish_belsare)\
**Post date:** [February 19, 2010, 12:25pm UTC](https://www.ruby-forum.com/t/ajax-problem/183746/2 "2010-02-19T12:25:28Z")

</div>

> This is the error…  
> That’s not an error, thats the script that should be run on the page  
> when the request completes. Are you sure you’re submitting an ajax  
> request, and not just a regular request?

---

<div class="post-metadata">

**Author:** ![manish\_belsare](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7993a0/32.png) [@manish\_belsare](https://www.ruby-forum.com/u/manish_belsare)\
**Post date:** [February 19, 2010, 3:55pm UTC](https://www.ruby-forum.com/t/ajax-problem/183746/3 "2010-02-19T15:55:01Z")

</div>

Manish B. wrote:

> “try {  
> Element.hide(“add\_answer\_link\_for\_post\_-613772418”);  
> Element.update(“new\_answer\_form\_for\_post\_-613772418”, “\<form  
> action=”/answers” method=“post” onsubmit=“new  
> Ajax.Request(’/answers’, {asynchronous:true, evalScripts:true,  
> parameters:Form.serialize(this)}); return false;”\>\n\n
> 
> New Answer\n \n \n\n\n\n"); } catch (e) { alert('RJS error:\n\n' + e.toString()); alert('Element.hide(\"add\_answer\_link\_for\_post\_-613772418\"); \nElement.update(\"new\_answer\_form\_for\_post\_-613772418\", \"\\n\\n New Answer\\n \\n \\n\\n\\n\\n\");'); throw e }"
> 
> I want to eliminate this problem wen i m implementing ajax requests…  
> Please help…
> 
> This is the error…Can u please guide?

Looks like this is from a View link\_to\_remote to replace or change the  
content on a page. The Controller should have  
render :update do |page|  
page.replace\_html ‘id\_of\_element’, “content to change”  
end  
It would be best to post the View and Controller code so we can assist.
