laravel5 ajax 419,php - Ajax LARAVEL 419 POST error - Stack Overflow

作者在使用AJAX通过POST请求加载'/company'路由时遇到419未知状态错误,寻求帮助解决Blade.php视图(company.blade.php)与Controller中loadContent方法配合的问题,内容涉及前端AJAX、PHP Laravel路由和视图渲染。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I would really appreciate some help on this.

I tried tons of solutions as posted in this forum, but I cannot 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 am calling the view through my route

Route::post('/company', 'Ajaxcontroller@loadContent');

And controller

public function loadContent()

{

return view('listing.company')->render();

}

My company.blade.php is

@foreach ($companies as $company)

{{$company->name}}
{{$company->streetaddress}} {{$company->postalcode}}

= $service; ?> is available on <?php echo $date; ?>

@endforeach

I am getting this error

POST http://127.0.0.1:8234/company 419 (unknown status)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值