Support the ongoing development of Laravel.io →
posted 5 years ago
Laravel
Last updated 2 years ago.
0
$.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 );
}
0

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>
Last updated 5 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.