# Rails, AJAX, and extra URL parameters

**URL:** <https://www.ruby-forum.com/t/rails-ajax-and-extra-url-parameters/111819>\
**Category:** Rails\
**Created:** [August 11, 2007, 5:35pm UTC](https://www.ruby-forum.com/t/rails-ajax-and-extra-url-parameters/111819 "2007-08-11T17:35:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a587f6/32.png) [@kuma](https://www.ruby-forum.com/u/kuma)\
**Post date:** [August 11, 2007, 5:35pm UTC](https://www.ruby-forum.com/t/rails-ajax-and-extra-url-parameters/111819/1 "2007-08-11T17:35:04Z")

</div>

I recently updated an app from 1.1.6 to 1.2.3

Some places in the code, there are items like this:

```
                <%= in_place_editor "overrule_#{@candidate.id}_#{@

```

question.id}",  
{:url =\>{  
:controller =\>‘grade’,  
:action=\>‘set\_grade\_overrule’,  
:candidate\_id =\> @candidate.id,  
:question\_id=\> @question.id},  
}  
%\>

instead of rendering ?candidate\_id=1&question\_id=1552  
we get ?candidate\_id=1&question\_id=1552

Now, I can solve this problem by defining routes, but is this correct  
that  
the URL is getting escaped? That seems wrong to me.

Is there a better way to pass additional parameters to the server  
instead of  
in the url when doing an ajax call?

---

<div class="post-metadata">

**Author:** ![kuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a587f6/32.png) [@kuma](https://www.ruby-forum.com/u/kuma)\
**Post date:** [August 11, 2007, 8:21pm UTC](https://www.ruby-forum.com/t/rails-ajax-and-extra-url-parameters/111819/2 "2007-08-11T20:21:17Z")

</div>

Brian H. wrote:

> instead of rendering ?candidate\_id=1&question\_id=1552  
> we get ?candidate\_id=1&question\_id=1552

I believe that is how it is supposed to work. Valid XHTML syntac says  
that attributes of elements must be HTML escaped.

When the browser makes the request, it should properly decode it to what  
its supposed to be.

I know you can pass jaascript variables with the request, but I am not  
familar with the sytac of that. Look up the :with option on the ajax  
helpers.

---

<div class="post-metadata">

**Author:** ![kuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a587f6/32.png) [@kuma](https://www.ruby-forum.com/u/kuma)\
**Post date:** [August 11, 2007, 10:50pm UTC](https://www.ruby-forum.com/t/rails-ajax-and-extra-url-parameters/111819/3 "2007-08-11T22:50:36Z")

</div>

Yeah… it “should” decode it… but according to firebug, and my Rails  
application, it does not.

Firebug’s output:

amp;question\_id1729candidate\_id1  
Notice that it’s amp;question\_id instead of question\_id. So it’s the  
unescaping that’s broken?

I don’t like the ‘with’ option cos I always screw it up, but it would  
probably be better. Right now this is fixable with named routes… but  
man,  
why can’t it be easy?
