incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Cottlehuber <...@jsonified.com>
Subject Re: how to save json document into couchdb using javascript
Date Mon, 03 Sep 2012 12:23:59 GMT
On 3 September 2012 06:48, lenin <leningovi@gmail.com> wrote:
> yes...same ip for both.........
>
>
>
> --
> View this message in context: http://couchdb-development.1959287.n2.nabble.com/how-to-save-json-document-into-couchdb-using-javascript-tp7580825p7580843.html
> Sent from the CouchDB Development mailing list archive at Nabble.com.

Hi Lenin,

Let's shift this conversation to the user@ mailing list where it's
more appropriate.

You'll need to share some of your non-working code with us, to better
understand where you are stuck --  e.g. on http://friendpaste.com/ or
on gist.github.com.

The issue you are having is that the call you're trying to make is
forbidden because they're different origins. I suggest you google for
an explanation in your native language, it will help a lot.

There are many ways of working around this, but the simplest way in
CouchDB is simply to serve the HTML & the database from the same
origin. This is way cool. There is a tool called couchapp which
synchronises files on disk with design documents in your database and
makes this really really simple.

TL;DR:

- download & install couchapp for your platform[1]
- then `couchapp generate myapp`
- put your html files (like index.html and js files) in "myapp/_attachments/"
- `couchapp push` will send these new files to your localhost:5984 (in
admin party) into a new db called myapp
- visit the new url and play

You can use the same code that futon does jquery.couch.js[2] and check
in the test suite for examples on how to hook all of that together.
Running the test suite in the chrome developer tools gives a very good
overview of how this stuff should work.

Useful docs for jquery.couch.js[2] and test suite[3] follow.

A+
Dave

[1]: http://couchapp.org/
[2]: http://daleharvey.github.com/jquery.couch.js-docs/symbols/index.html
[3]: https://github.com/apache/couchdb/tree/1.2.0/share/www/script

Mime
View raw message