couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Walter Werner <wer...@googlemail.com>
Subject Re: jquery-ajax encodeURI Problems
Date Mon, 15 Nov 2010 09:31:57 GMT
hi Randall

You where absolutely right, with double quotes "foo" it works now. And
i thought it has something to do with couchdb does not understand
url-encoding characters.

let the force be with you ;)
  Walter



2010/11/15 Randall Leeds <randall.leeds@gmail.com>:
> 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
View raw message