Ajax Request using jQuery in Rails

Posted by Steve on Stack Overflow See other posts from Stack Overflow or by Steve
Published on 2010-06-02T20:23:43Z Indexed on 2010/06/02 21:04 UTC
Read the original article Hit count: 231

Filed under:
|
|
|

Hi... I am sending an Ajax Request using jQuery. What happens is that I am getting an "405 Method Not Allowed" Error. I am just posting a form, which would get the detail from the form and insert it into the DB. Just the usual stuff.I am using WEBrick that comes as default with the rails package. Can somebody please tell me how to fix this.

This is the code that triggers the Ajax Request

$.post($(this).attr("action") + ".js",$(this).serialize(),null,"script");

Response Headers
Cache-Control   no-cache
Allow   GET, PUT, DELETE
Content-Type    text/html; charset=utf-8
Content-Length  9502
Server  WEBrick/1.3.1 (Ruby/1.9.1/2009-12-07)
Date    Wed, 02 Jun 2010 20:41:33 GMT
Connection  Keep-Alive

Request Headers
Host    localhost:3000
User-Agent  Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Accept  application/json, text/javascript, */*
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive  115
Connection  keep-alive
Content-Type    application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With    XMLHttpRequest
Referer http://localhost:3000/viewspot/3
Content-Length  141
Pragma  no-cache
Cache-Control   no-cache

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ruby-on-rails