In my local project I'm trying to get response from the queries. Then I'm trying to show the notification messages via sweet alert, but I have some problems. When I try to get the response, it gets an array type mean normal text like the picture below,
My code is below:
My settings blade.php
<script src="/js/jquery.validate.min.js"></script>
<script scr="/js/jquery.form.min.js"></script>
<script src="/js/messages_tr.min.js"></script>
<script src="/js/sweetalert2.min.js"></script>
<script>
$(document).ready(function () {
$('form').validate();
$('form').ajaxForm({
beforeSubmit : function(){
},
success:function (response) {
swal(
response.baslik,
response.icerik,
response.durum
)
}
});
});
</script>
My controller.php
$ayarlar = ayarlar::where('id',1)->update($request->all());
if($ayarlar) {
return response(['baslik'=>'Başarılı','icerik'=>'Kayıt
Başarılı','durum'=>'success']);
}else {
return response(['baslik'=>'Başarılı','icerik'=>'Kayıt
Başarılı','durum'=>'error']);
}