Django view doen't able to return json on ajax success? Django view doen't able to return json on ajax success? json json

Django view doen't able to return json on ajax success?


parseJSON isn't needed.

Since you're just working with a dictionary you can just access it as you would with any other dictionary in javascript

For example.

alert(ret_json.stat);


With HttpResponse and json dump, you can get response data in js like this

var val = $.ajax({    url:"feed/get_comments/",    type: "GET",    data:{c_id: cid}, //cid is a variable initialized above and not creating any problem    success: function(ret_json){        alert("Inside success"); //Running everytime        var sam_json = '{"stat":"Success"}'; //same as what is given in JsonResponse        var data = jQuery.parseJSON(val.responseText); //for debugging change to sam_json        alert(data); //with sam_json alerting with dictionary, with ret_json not giving any alert     },    

val.responseText will have the data you are sending from view.