Forum for discussing general topics related to Couch.
2 posts Page 1 of 1
Hi everybody,

Im not particularly new to AJAX in general but have never done anything ajax related with couch.

I have a project tool with following relationship: projects (1:n) pages. Now when i'm on the project webpage in the frontend (inline edit activated) I would like to be able to create a page with ajax, with the only parameter being the relation to the specific project i'm viewing. Shouldnt be that hard right? The rest of the page will then be editable via inline editing (thats why i only need that one parameter, no form needed). If the initiation of the inline fields isn't possible after reloading the data with ajax, I wouldn't be too unhappy with a simple reload of the whole page.

Does anyone have some help to offer regarding my issue? Or maybe even a good tutorial regarding CRUD and AJAX in couch. Thank you!

Regards,
Laduma
Hi Laduma,

AJAX, essentially, is a client-side technique - I mean the server-side (Couch in our case) is concerned only in handling the incoming request and doesn't (normally) care if that request originated, for example, with a link being clicked in a browser or programmatically through JavaScript (which would make the request AJAX).

So, in your case if suppose we create a regular Couch template that can be called by typing its URL in the browser's address bar and providing the 'project_id' as a querystring parameter, we can then use <cms:db_persist /> tag within it to create a new cloned page.

The above template will work exactly the same if we chose to call it via JQuery's $ajax object so we can put aside AJAX for the purpose of this discussion and concentrate only on creating the kind of template described above.

As I mentioned, the tag to use is <cms:db_persist /> (we could also use <cms:db_persist_form /> but then we'll have to use it within a databound form). You can find more details about it here - viewtopic.php?p=15104#p15104

A related CRUD tag is <cms:db_delete /> about which you can find more here -
https://www.couchcms.com/forum/viewtopi ... 87&p=25314

Perhaps you'll also find our 'advanced' tutorial helpful where we code up some CRUD stuff - http://www.couchcms.com/docs/advanced-t ... index.html

Please take a look at the mentioned links and let me know if you think that gives you sufficient info to move forward with.

Hope it helps.
2 posts Page 1 of 1