I’m using AngularJS one of my module’s settings page, so I have a javascript object in client side as a model. Could anyone help me please, how to catch this data in a controller if I send it as JSON with ajax?
This is the model I assembled is angular:
var model = { title: 'This is a title', url: '/random-custom-url', description: 'little descrp', blocks: [ {id: 1, name: 'block1', description: 'blockdecrtiption1', terms: [{"tid":"1","name":"term1","vid":"tags"}]}, {id: null, name: 'block2', description: 'blockdecrtiption2', terms: []}, {id: 3, name: 'block3', description: 'blockdecrtiption3', terms: []} ] };
I’d like to “catch” it in a controller’s function(as a php associative array), so then I can process it and save to database(I have some own table in the database, created in the module’s hook_schema()). What’s the right route setup for this? In the controller’s function how can I get the data posted with ajax and how to convert it to associative array?
Thanks a lot!