This is just some more info. Where is "OPTIONS" coming from? It looks like the view function tries to use GET, but we end up with OPTIONS.
OPTIONS http://test:5984/forms/_design/formlist/_view/formlist HTTP/1.1 Host: test:5984 Connection: keep-alive Access-Control-Request-Method: GET Origin: null User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19 Access-Control-Request-Headers: origin, content-type, accept Accept: */* Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 -----Original Message----- From: Hankey, Chris [mailto:[email protected]] Sent: Saturday, May 19, 2012 5:54 PM To: [email protected] Subject: Call to View returns 405. It's using OPTIONS not GET I'm trying to call a view using the CouchDB Javascript API. The $db.view call is failing with a "405 Method Not Allowed" error. $db.view is generating the correct URL, but the call appears to be failing because the view function is using HTTP OPTIONS method ( or maybe JQuery). If I change the HTTP method to GET & manually send the HTTP request, then it works fine. I need $db.view to generate a GET. Any thoughts? Thanks Chris ----------- Sample Code ----------- $.couch.urlPrefix ="http://test:5984" $db = $.couch.db("forms"); function GetFormList() { $("div#forms").empty(); $db.view("formviews/formlist", { success: function(data) { for (i in data.rows) { id = data.rows[i].id; html = '<div class="form">' + '<span class="form">' + id + '</span> ' + '<a href="#" class="edit">edit</a> '+ '<a href="#" class="delete">delete</a> '+ '</div>'; $("div#forms").append(html); } }}); }
