Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.ajaxSetup({
- headers: {
- 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
- }
- });
- $('#search_user_form_profile').on('keyup',function(){
- $value=$(this).val();
- $.ajax({
- method: 'POST',
- url: '{{route('user.profile.search')}}',
- data: {
- 'data' : $value
- },
- success: function(response){
- console.log(response);
- var html = '';
- for(let i = 0; i < response.message.length; i++)
- {
- let tempHtml = "<span class="border-bottom border-dark"> <a href="" style="width:25vw;font-size: 1em;">" + response.message[i].name + "</a></span><br>";
- html = html + tempHtml;
- }
- console.log(html);
- $( "div.demo-container" )
- .html(html);
- },
- error: function(jqXHR, textStatus, errorThrown) {
- console.log(jqXHR, textStatus, errorThrown);
- }
- });
- })
- if(request()->ajax()){
- $input = Input::get('data');
- $user = User::where('name', 'LIKE', '%' . $input . '%')
- ->where('id', '!=', auth()->user()->id)
- ->get();
- return response()->json(['status' => 'success', 'message' => $user]);
- } else {
- return response()->json(['status' => 'fail', 'message' => 'an error occurred']);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement