This is my initial dive into ajax, where I have created a submit handler that extracts form data and sends it to the server via POST in JSON format. Below is a basic overview of my JavaScript code:
formData = JSON.stringify({'testA':{'testa':'some data'},'testB':{'test2':'more data'}});
The resulting JSON string resembles this:
{"testA":{"test1":"some data"},"testB":{"test2":"more data"}}
and the data is sent using $.post as shown below:
$.post("/some/form/page/", formData, updateForm, 'json');
However, an issue arises on the server side when examining the query dictionary within Django view:
<QueryDict: {u'{"testA":{"test1":"some data"},"testB":{"test2":"more data"}}': [u'']}>
In this case, the JSON string becomes the key of the query dictionary. As a beginner with limited experience in JavaScript and JSON, I welcome any constructive criticism to help me improve. Thank you!