incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikeal Rogers <mikeal.rog...@gmail.com>
Subject Re: Line Breaks in JSON Causing Issue With jQuery
Date Tue, 09 Nov 2010 17:52:31 GMT
jsonp isn't enabled by default so it may actually not be embedding the
callback in the response. Might want to try just normal json instead. To my
knowledge we don't add any line breaks between json elements.

-Mikeal

On Tue, Nov 9, 2010 at 9:49 AM, Matthew Woodward <matt@mattwoodward.com>wrote:

> Hello fellow relaxers--I'm fairly new to CouchDB and loving it so far, but
> I
> ran into a bit of an issue when calling a view directly from jQuery. I'm
> sure I'm just missing something obvious, but here goes.
>
> I have a view in CouchDB that I'm calling from jQuery like so:
>
> var couchURL = "
> http://server:5984/database/_design/mydesigndoc/_view/viewName";
> $.ajax({
>    dataType: "jsonp",
>    url: couchURL,
>    jsonpCallback: "myCallback",
>    success: myCallback
> });
>
> The view works fine when I hit it in a browser. The problem I'm having is
> that, I believe because of the line break after the first array bracket in
> the "rows" element, jQuery doesn't see this as valid JSON. The error I get
> is "invalid label" and it appears to break right at the line break (at
> least
> according to Firebug).
>
> Any suggestions welcome. Thanks!
>
> --
> Matthew Woodward
> matt@mattwoodward.com
> http://blog.mattwoodward.com
> identi.ca / Twitter: @mpwoodward
>
> Please do not send me proprietary file formats such as Word, PowerPoint,
> etc. as attachments.
> http://www.gnu.org/philosophy/no-word-attachments.html
>

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