I have ajax like this:
$(".cq").on("input", function() {
$.ajax({
url: "create/reefFormAjax",
type: "POST",
data: $(this.form).serialize(),
success: function(data) {
callback(data);
}
});
});
function callback(response) {
$(".sum_whl").val(response);
$(".sum_rtl").val(response);
}
So in my controller I have something like this:
$test = $request->all();
return json_encode($test);
Then I retrieve data back to my view:
{
"material": "0",
"mquantity": null,
"cq": "2",
"sum_rtl": null,
"sum_whl": null
}
The question is how I can get each value from response ?
I tried $(response).find('cq').val() or filter but I an have error.
Any ideas?