Update 2sxc Content Field from JavaScript

Oct 27, 2015 at 9:26 PM
I'm having trouble updating a content field for an app using Razor and JavaScript. I'm looking at this documentation, but I can't figure out how to put it all together.

I have a Content type called "Popup", and a number field in it called "TimesOpened". I want to increment TimesOpened from a JavaScript function.

In your example...
App.Data.Update(Id-As-Int, DictionaryOfValuesToChange);
What ID goes into "Id-As-Int"? Is it the content entity ID or the App ID?

For the dictionary of values part, would it go in like this?
App.Data.Update(Id-As-Int, Values.Add(TimesOpened, TimesOpened++));
Lastly, how would I trigger this update from say, a JQuery function like this?

Thanks guys! Looking forward to trying out 2sxc 8!
Dec 15, 2015 at 1:39 PM
Hey grayspace,
Did you fix that problem?

i'm having the same issue.

Dec 16, 2015 at 5:55 PM

I ended up not needing a solution to the posted problem, but I have since used the example app called "Tutorial WebAPI - Feedback Form" to help me figure out a way to use the API to create and update items in the database.

Check out or download the app here: http://2sxc.org/en/Apps/Details?AppGuid=f349598f-c13f-48ad-8bb9-5c0ce5ad425a