How do I avoid cross-domain issues accessing node.js using AJAX? -


i using node.js express, jade , sass application. have couchdb database , use using ajax. normally, access couchdb ajax create document in database , attach html file it, served same domain. however, of site generated using templates served node.js, means being served different domain couchdb's server. how round this?

you need enable cross-domain communication in express, please check answer: using express , node, how maintain session across subdomains/hostheaders

as might consider of using jsonp browser support. in order enable add line:

app.set('jsonp callback', true); 

to app.configure in express.
, when send answers use method:

res.jsonp({ some: 'data' }); 

Comments