couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randall Leeds <randall.le...@gmail.com>
Subject Re: jquery-ajax encodeURI Problems
Date Mon, 15 Nov 2010 08:34:43 GMT
Without testing this myself, I wonder if it's your choice of quotation
marks. Try using single quotes to delimit the strings and using double
quotes withing the actual JSON. Such as {startkey: '["foo", {}]'}. If memory
serves me correctly only double quoted strings are valid JSON. But I'm
tired, I could be inventing this :)
On Nov 15, 2010 12:14 AM, "Walter Werner" <wernwa@googlemail.com> wrote:
> hi
>
> I am new to the mailinglist, hello to everyone. The web Interface of
> this mainling list seems not to have any search function, i hope this
> problem is new.
>
> When i am trying to make a GET request to one of my couchdb-search-view
>
> $.get('/mydb/_design/02/_view/search', {startkey:"['foo',0]",
> endkey: "['foo',{}]",reduce:true, group:true},
> function(data) {
> alert(data);
> }
> );
>
> I get the error:
>
> {"error":"bad_request","reason":"invalid UTF-8 JSON"}
>
> and my url looks like this:
>
>
http://localhost:5984/mydb/_design/02/_view/search?startkey=%5B%27foo%27%2C0%5D&endkey=%5B%27foo%27%2C%7B%7D%5D&reduce=true&group=true
>
> The quotation marks and the [ ] that are needed for the JSON format
> are url-encodet inside the $.get function. I do not know how to change
> this behaviour. I also tried it with $.post and $.ajax. The same
> result. Can anyone help?
>
> Thanks
> Walter

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message