I am sending an ajax request from a jQuery file, as shown below, which is awaiting a response in JSON.
jQuery.ajax({ url: '/Control/getImageDetails?file_id='+currentId, type: 'GET', contentType: 'application/json', success: function (data){ alert(data); } }); });
In Python, I sent a response to an Ajax request as such:
record = meta.Session.query(model.BannerImg).get(fid) return_info = [record.file_id, record.filename, record.links_to] return result_info
This returns the parameters in plain text, which makes it impossible to read in different values. I believe sending a response from python since JSON solves this problem. Previously, I used a JSON server. How can I return the response as JSON?
json jquery python ajax
Sushan ghimire
source share