i have one problem, and I cant solve it.
In my controller i have method:
public function deleteImg(Request $request, $id) {
$image_id = $request->input('imgId');
$image_src = $request->input('imgSrc');
AdImages::delete($id, $image_id, $image_src);
}
Inside of AdImages class I have static method:
public static function delete($id, $image_id, $image_src) {
return response()->json(['status' => 'error', 'message' => 'Error occurred. Please try again.']);
}
And here is ajax:
$.ajax({
url: '/dashboard/ad/{{ $ad->id }}/remove-image',
type: 'POST',
data: {imgId: imgId, imgSrc: imgSrc},
success: function(data) {
console.log(data);
}
})
Problem is if i return response i got nothing, empty string. But if i var dump(response()->...) i see object i need.
Any ideas/suggestions ?
Thank you
return response()->json(['status' => 'error', 'message' => 'Error occurred. Please try again.'])doechothat array