Since the script is being run from a document within the database (http://localhost:5984/sessions/index.html) it doesn't appear as though I need to provide the database name. The following script resulted in the same output:

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

From my understanding, here is the basic hierarchy. (I hope it renders okay)

sessions (db)
      |___ index.html
      |
      |___ _view
      |            |___ status
      |            |___ srcAddr
      |
      |___ _list
                    |___ sort


Chris



David M. W. Martin
January 19, 2011 9:04 AM


seems you have not specified your database
this snippet got 20 jpg images and appended them to a
html div target

var i, database = "/otperl_array_of_urls_020/",
command = "_all_docs",
startkeyVal = "\"2000-10-11-11-26-32-0\"",
endkeyVal = "\"2000-10-12-08-55-35-0\"",
limitVal = 20,
mytarget1 = $('div#thumbnails');


$.getJSON(database + command,
{startkey: startkeyVal,
endkey: endkeyVal,
limit: limitVal },
function (data, status) {
mytarget1.html(
"<img src=\"/otperl_array_of_urls_020/" +
data.rows[0].id + "/th_" +
data.rows[0].key + ".jpg\"/>"
);

for (i = 1; i < limitVal; i = i + 1) {
mytarget1.append(
"<img src=\"/otperl_array_of_urls_020/" +
data.rows[i].id + "/th_" +
data.rows[i].key + ".jpg\"/>"
);

};
}); //end of getJSON


Chris Johnson
January 18, 2011 6:33 PM

I am new to couchdb and have been successfully using it with the python libs. I am trying to move to JS, which I am new to as well, and having some challenges. I know this is a simple question, so please bare with me. I am trying to make a simple ajax call to pull data from a view but get an error. I have tried with both the full URL and just he view information with no luck. What am I missing?

<script type="text/javascript" charset="utf-8">
         $.getJSON("_view/status", function(data) {
            alert("JSON Data: " + data);
          });
</script>