Creating XObjects from JavaScript

Greetings!

I’m trying to add some XObjects to a page from JavaScript. The reason is that I’m building an entry form which has some interactive components. The user can edit a list of elements which consist of custom components. I don’t want to reload the page which is why I’m doing it in JavaScript.

Originally I serialized all the data into a form field. But I think it would be nicer to have XObjects to store the structured data. Does that make sense? Or am I approaching this from a wrong angle? I’m quite new to XWiki.

edit: I think I can use the REST API if the page already exists. I’m not sure though how it works when the page is being created and not saved yet.

Thanks!
Yves

Hi, you can use the objectadd action in the URL. I was looking for documentation about it and couldn’t find it so I’ve added it to https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Architecture/URL%20Architecture/Standard%20URL%20Format/#HAction:objectadd

Hope it helps