Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

ajax get with parameters

              $.ajax({
  url: "{{url('urlname')}}",
  type: "get",
  data: { 
    data:'id', 
  },
  success: function(response) {
    console.log(response);
  },
  error: function(xhr) {
    //Do Something to handle error
  }});

/////////web//////////
 Route::get('urlname', 'Controller@urlname')->name('urlname');

///controller//////////
    public function urlname(Request $request){
        return $request->id;
    }
 
PREVIOUS NEXT
Tagged: #ajax #parameters
ADD COMMENT
Topic
Name
2+5 =