jeudi 4 août 2016

Updating Model inside of view

I've been working on a photography page for a while now. Now I've tried to create a page on which user will upload photos to database.

I wanted to give the user an option of selecting photo categories on the create/upload page using checkboxes. I wanted to use a viewmodel with list of categoryview models which would represent the checkboxes.

Now the tricky part that i need some help with is how do I allow user to dynamically add new categories (if he needs to) on the same page. So how would i add new values into the list of categories on view.

Only thing that comes to my mind is to create an ajax post that would call a method that would create the new category in the database. Then i could append a new checkbox representing that category, But then i do not know how i would send that category in the list of categories in viewmodel without refreshing current page. Is this even possible?

If any1 has any ideas how to start on this I would be grateful.




Aucun commentaire:

Enregistrer un commentaire