My problem is that I must post a JSON object in the following format:
{"Key1": "value1", "key2": 2, "options": {"content": "lorem ipsum"}} but I'm getting an internal server error I did not find the key 'option'. This is my JS code:
$ ("# button"). Click on the button (function () {var json_test = {"key1": "value1", "key2": 2, "option": {"content": "leerem ipsum"}} $ .ajax ({type: "post" , Url: '/ test / url /', data type: 'Jason', data: json_test})}); And this is also the post content from Agnibog:
learning element_type text_page option 1 [content] lorem ipsum I am clearly doing something wrong but I can not understand how it is. Any ideas?
I'm not sure, but you can remember json string < ({{"Content": "lorem ipsum"}} $ .jax ({type: "post", "value", "value1", "key2": 2, "option" URL: '/ Course / API / Element /', Data Type: 'Jason', Data: JSON.stringify (json_test)})});
Also, add
contentType: "application / json; charset = utf-8" Try Jquery Options
No comments:
Post a Comment