You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by CGS <cg...@gmail.com> on 2012/09/03 00:15:23 UTC

Re: how to save json document into couchdb using javascript

Do you have the same IP and the same port for both requester and receiver?



On Fri, Aug 31, 2012 at 7:37 AM, lenin <le...@gmail.com> wrote:

> when i am running your code that i am getting the following error:
>
> *NS_ERROR_DOM_BAD_URI:Access to restricted URI denied*
>
> when i click the error n console it is going to the below line
>
> *xmlhttp.send("data="+JSON.stringify(myJSON));*
>
>
> please help to solve the above problem........
> thanks in advance
>
>
> Regards
> G.Lenin
> Research Scientist
>
>
>
> --
> View this message in context:
> http://couchdb-development.1959287.n2.nabble.com/how-to-save-json-document-into-couchdb-using-javascript-tp7580825p7580829.html
> Sent from the CouchDB Development mailing list archive at Nabble.com.
>

Re: how to save json document into couchdb using javascript

Posted by Dave Cottlehuber <dc...@jsonified.com>.
On 3 September 2012 06:48, lenin <le...@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

Re: how to save json document into couchdb using javascript

Posted by lenin <le...@gmail.com>.
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.