2π
β
you need to add βjsonβ after the callback to let jquery know that the return data should be json. jQuery will then automatically parse your json string into a JavaScript object.
$(".edit_rec").click(function () {
var rec_id = $(this).attr('name');
$.post("/edit/", {
editid: rec_id
}, function (content) {
var to = new String(content.to_date);
var from = new String(content.from_date);
},"json");
});
π€Kevin B
Source:stackexchange.com