small medium large xlarge

23 Sep 2008, 10:39
Kero Sinha (4 posts)


sorry if his was discussed before.

For me it seems that all requests to add_to_cart are using a GET method instead of POST

If I use either the ‘Add to cart’ button:

`<form method="post" action="/store/add_to_cart/6" class="button-to">


Or the picture link:

<a href="/store/add_to_cart/6" onclick="var f = document.createElement('form'); = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var s = document.createElement('input'); s.setAttribute('type', 'hidden'); s.setAttribute('name', 'authenticity_token'); s.setAttribute('value', 'b8c5d31b0519ce5102ebadde7bc08ea36683ed05'); f.appendChild(s);f.submit();return false;"><img alt="Svn" src="/images/svn.jpg?1221819234" /></a>

In both cases I end up with the GET method URL in my browser:


I’ve tested this with IE7,Firefox 3 and Chrome with the same results

Any ideas?

Thank you :)

23 Sep 2008, 15:38
Kero Sinha (4 posts)

My guess is that possible cause of this is in not including

<%= javascript_include_tag :defaults %>

in the layout

04 Nov 2008, 08:13
Mikhail V. Shokhirev (a.k.a. Mike Shock) (19 posts)


You wrote “the GET method URL”, but GET and POST (and PUT) methods may (in general) be applied to the same URL… Do you find out from the log file that “all requests to add_to_cart are using a GET method instead of POST”?

You must be logged in to comment