$.ajax({
type: 'post',
url: '/editItem',
data: {
'_token': $('input[name=_token]').val(),
'id': $("#empid").val(),
'name': $('#name').val()
},
success: function(data) {
//code
}
});
controller
public function reitem(Request $req) {
$data = Data::all ();
return view ( 'welcome' )->withData ( $data );
}
try:
success : function (data) { console.log(data); }
and in blade: @{{ data.id }} or any other field in your DATA::all(); model
/// you may also try
<script> var mydata= JSON.parse("{{ json_encode($data) }}"); </script>Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community