Is there a way to pass JSON objects to the front end of a web template if using the Django framework or Python in general?
For example, if I want to send an object that has two arrays as properties (let’s say xvalues and yvalues), how would I be able to use JavaScript or jQuery to do an Ajax call to obtain the object that has the properties?
Complementing zeekay answer, if you want to send only an object you could do a json dump, for example:
That way you will receive that data via your ajax success and do whatever you want with it.
You can send over lists too, when you receive your response sometimes you will need to do a JSON.parse on data (sometimes cause when you send a dictionary I think is not necessary)