Daniele B
Daniele B

Reputation: 3125

Is it possible to include external javascript code in a coucdhb list function?

...not more to add apart the title:

I have a list functions which formats the result of a view according to some values contained in an array

var array=[val1, val2, val3...]

As this array is also used in my javascript client-side functions, and grabbed from a globvar.js file on the server, is it possible to include it in a list functions?

How?

Should I execute an ajax request?

thanks for answering.

Upvotes: 2

Views: 643

Answers (1)

Marcello Nuccio
Marcello Nuccio

Reputation: 3901

You can put it in a CommonJS module: http://wiki.apache.org/couchdb/CommonJS_Modules

You can't do ajax requests within CouchDB.

EDIT: latest documentation is at http://docs.couchdb.org/en/latest/query-server/javascript.html#require

Upvotes: 2

Related Questions