incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From N/A N/A <pressley...@yahoo.com>
Subject Re: simple AJAX request
Date Thu, 20 Jan 2011 11:45:17 GMT
Hi,

And whats inside this [object Object] ? What is the answer of the server ? What 
you get as response ?
Put the server in debug mode. Why don't you try to call this view using curl or 
some other tool ?

If the answer if JSON object(as expected) in this case data object is actually 
this JSON. So you are trying to log the object
which i doubt is your idea. 

For example let's assume this. I have the following JSON response from 
couchdb '{"answer":"oops"}'

var my = JSON.parse('{"answer":"oops"}');

So if i want to output my answer i have to:

console.log(my.answer) 
or 
alert(my.answer)

If you just print "my" object you will get the object. 

regards


________________________________
From: Chris Johnson <csj790@yahoo.com>
To: user@couchdb.apache.org
Sent: Thu, January 20, 2011 5:10:33 AM
Subject: Re: simple AJAX request

Here was the code that was provided, the first being the couch.js lib, which is 
what I think you are referring to:

Here is the code snippet for each of them:
<script type="text/javascript" charset="utf-8">
           db = $.couch.db("sessions");
           $.log('info :' + db.info());
</script>

<script type="text/javascript" charset="utf-8">
           $.getJSON('_list/sort/srcAddr?group=true', function(data) {
               $.log('list: ' + data)});
</script>

If I use firebug and look at the output, the headers and response look
like I would expect, but the log for the couch.js request shows "info:
undefined" and the log from the ajax call show "list: [object Object]."

I am sure it is something small that I am missing, but I am stumped as
to what



Chris Johnson wrote:
> Here was the code that was provided, the first being the couch.js lib, which is 
>what I think you are referring to:
>
> Here is the code snippet for each of them:
> <script type="text/javascript" charset="utf-8">
>            db = $.couch.db("sessions");
>            $.log('info :' + db.info());
> </script>
>
> <script type="text/javascript" charset="utf-8">
>            $.getJSON('_list/sort/srcAddr?group=true', function(data) {
>                $.log('list: ' + data)});
> </script>
>
> If I use firebug and look at the output, the headers and response look
> like I would expect, but the log for the couch.js request shows "info:
> undefined" and the log from the ajax call show "list: [object Object]."
>
> I am sure it is something small that I am missing, but I am stumped as
> to what...



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