2011/12/8 Michael Bykov <[email protected]>:
> Hi,
>
> I am trying to ping parallel /counters base.
>
> default.ini:
>
> secure_rewrites = false
>
> rewrites:
> {
> "from":"/counter",
> "to":"../../../counters",
> "method":"PUT",
> "query":{}
> },
>
> ajax call:
>
> pingCounter: function(obj){
> console.log('ping: ');
> $.ajax({
> type: "PUT",
> url: '/counter',
> data: { page : obj },
> dataType: 'json',
> success: function(msg) {
> console.log( "ping saved: " + msg );
> }
> });
> }
>
> And in log I got
>
> 'PUT' /counters 401 <=== note correct 'counters' DB name, so rewrites works
> ok.
>
> But this error occurred: {"error":"unauthorized","reason":"You are not
> a server admin."}
>
> Where I should place my admin password for DB "counters" ? In rewrites
> rule? But how?
>
>
> --
> М.
>
> http://diglossa.ru
> xmpp://[email protected]
I've got an answer, it works with
pingCounter: function(obj){
console.log('ping inner: '+inspect(obj));
$.ajax({
type: 'POST',
url: '/counter',
data: JSON.stringify(obj),
dataType: 'json',
contentType: 'application/json',
success: function(msg) {
console.log( "ping saved: " + msg );
},
error: function(msg) {
console.log( "my ping error: "+msg);
}
});
}
--
М.
http://diglossa.ru
xmpp://[email protected]