Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>----- possible solution -----</p> <p>So, I got a solution that worked for me. However I had to use apache as a Proxy server to circumvent the cross origin policy.</p> <p>The idea here is to remove the problems with the cross domain policy and use an http-server to proxy our request locally to the couchdb service. Every request for example.com/couch will be redirected to the couchdb service. That way you don't have to use a jsonp request anymore.</p> <p>The initial problem you asked about whether or not you can use your own error handling is directly linked to jsonp requests in jQuery as they do not use the error handlers - They never get called at all.</p> <p>Apache configuration:</p> <pre><code>&lt;VirtualHost 123.123.123.123:80&gt; ServerName example.com ProxyPass /couch http://localhost:5984 ProxyPassReverse /couch http://localhost:5984 &lt;/VirtualHost&gt; </code></pre> <p>jQuery ajax request:</p> <pre><code>var request = $.ajax({ url: "http://example.com/couch", dataType: "json", }).done(function() {console.log("done");}) .fail(function() {console.log("fail");}) .always(function() {console.log("always");}); }); </code></pre> <p>----- Original post -----</p> <p>You could try this:</p> <pre><code>var request = $.ajax({ url: myUrl, type: "GET", username: user, password: pass, dataType: "jsonp", success: function(){ console.log("ok"); }, error: function(){ console.log("error"); } }); </code></pre> <p>jQuery gives you the possibility to use the http basic auth via two ajax parameters (username and password).</p> <p>Or you might wanna try the <a href="http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/" rel="nofollow">CouchDB jQuery plugin</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload