I would really appreciate help on this. I tried many solutions posted on this forum, but I can not get it to work.
My ajax call is something like
$(document).ready(function() { $("#company").click(function() { $.ajax({ type: "POST", dataType:'html', url : "/company", success : function (data) { $("#result").html(data); } }); }); });
I call the view through my route
Route::post('/company', ' Ajaxcontroller@loadContent ');
And the controller
public function loadContent() { return view('listing.company')->render(); }
My company .blade.php
@foreach ($companies as $company) <div class="posting-description"> <h5 class="header"><a href="#"></a>{{$company->name}} </h5> <h5 class="header"> {{$company->streetaddress}} {{$company->postalcode}}</h5> <p class="header"> <span class="red-text"> <?= $service; ?> </span> is available on <span class="green-text"><?php echo $date; ?></span> </p> @endforeach
I get this error
POST http://127.0.0.1:8234/company 419 (unknown status)
source share