From user-return-21964-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Mon Sep 3 12:24:33 2012 Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 734E29CEE for ; Mon, 3 Sep 2012 12:24:33 +0000 (UTC) Received: (qmail 59882 invoked by uid 500); 3 Sep 2012 12:24:32 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 59612 invoked by uid 500); 3 Sep 2012 12:24:28 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 59553 invoked by uid 99); 3 Sep 2012 12:24:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Sep 2012 12:24:26 +0000 X-ASF-Spam-Status: No, hits=1.3 required=5.0 tests=FSL_RCVD_USER,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.216.45] (HELO mail-qa0-f45.google.com) (209.85.216.45) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Sep 2012 12:24:21 +0000 Received: by qadc10 with SMTP id c10so2386567qad.11 for ; Mon, 03 Sep 2012 05:23:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:content-type:x-gm-message-state; bh=UtT8LhXNOeGTk7nD0/tSTzHu6WrKyw87LrZ23oI328Y=; b=GSluGwYch4vnGU8lzL3hAjkOAJyPHa95jlIm1GIa+lZocdB3Hx33vV+m5ozo/5cWMA uoJEaBdgyIzdPFjZod8Ea/qSkcTKfVm9yWDpMvTMnW1cYAJwaRfjshGCFqaGXg+gPaUq Nv+l6SQIeS0WFctUlX9iufjkF8rCCvHzL4tKVYFvpSQO4Y5ibBaC419vOCsc3NDBHjyj 51VmcAndh5Gfpz9Gm/F64Fmn7le+Q3SE9LYhvaI+MANf2nq8MZYFvaZ6QeyP0Hq9GPJS vfHuAE4CdW9k8aU6QSCd02rqBOmBELpzGp/Auj8F/OSV4eZa8tOzBNwJR3T9b9WgBPoc 0Duw== MIME-Version: 1.0 Received: by 10.224.196.73 with SMTP id ef9mr34493870qab.36.1346675039366; Mon, 03 Sep 2012 05:23:59 -0700 (PDT) Received: by 10.49.86.74 with HTTP; Mon, 3 Sep 2012 05:23:59 -0700 (PDT) X-Originating-IP: [84.112.19.176] In-Reply-To: <1346647717571-7580843.post@n2.nabble.com> References: <1346326703020-7580825.post@n2.nabble.com> <1346391475290-7580829.post@n2.nabble.com> <1346647717571-7580843.post@n2.nabble.com> Date: Mon, 3 Sep 2012 14:23:59 +0200 Message-ID: Subject: Re: how to save json document into couchdb using javascript From: Dave Cottlehuber To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQl+pEK0xfPxw5WGmoXvL6zia/LNBmwdiHXhs3k2yjmS3+64bjztXbWumfvhImRKzVchojun X-Virus-Checked: Checked by ClamAV on apache.org On 3 September 2012 06:48, lenin 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