Ajax LARAVEL 419 POST error
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)
<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 am getting this error
POST http://127.0.0.1:8234/company 419 (unknown status)
php jquery ajax laravel
|
show 3 more comments
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)
<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 am getting this error
POST http://127.0.0.1:8234/company 419 (unknown status)
php jquery ajax laravel
1
Did you know that this@foreach
is a templating engine and not PHP ? and how it is supposed to request the database for companies if you're not calling the database, and also CSS is an interpreted language so saying It compiles the CSS files is incorrect! And finally, yeah you should do the logic in your controller and then pass the result of the view to be rendered to your Ajax!
– teeyo
Sep 28 '17 at 15:25
Yes, I am aware of that. It does not compile something like <?= $service; ?> too. How should I call the database, can you shed some light on that?
– Cowgirl
Sep 28 '17 at 15:29
You are using Laravel, an MVC framework, you need to create a route to an action in your controller in this action you will call the database using eloquent and pass the result to the view which should render back HTML.
– teeyo
Sep 28 '17 at 15:31
I am aware of that too. I tried doing that, but in my case, I pass the eloquent to my view, but that specific view needs to get access to the variable in the URL from GET method, it cannot do that. Additionally, I don't want to include the navbar and other things in that view.
– Cowgirl
Sep 28 '17 at 15:36
You create your portion of the view without extending the navbar and other componenet and you put only the loop code, I don't get it how you can't access the variable ? you pass the variable to the view, wich means it will be available in the view !
– teeyo
Sep 28 '17 at 15:38
|
show 3 more comments
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)
<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 am getting this error
POST http://127.0.0.1:8234/company 419 (unknown status)
php jquery ajax laravel
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)
<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 am getting this error
POST http://127.0.0.1:8234/company 419 (unknown status)
php jquery ajax laravel
php jquery ajax laravel
edited Sep 28 '17 at 16:23
Paul Roub
32.8k85875
32.8k85875
asked Sep 28 '17 at 15:20
CowgirlCowgirl
4541429
4541429
1
Did you know that this@foreach
is a templating engine and not PHP ? and how it is supposed to request the database for companies if you're not calling the database, and also CSS is an interpreted language so saying It compiles the CSS files is incorrect! And finally, yeah you should do the logic in your controller and then pass the result of the view to be rendered to your Ajax!
– teeyo
Sep 28 '17 at 15:25
Yes, I am aware of that. It does not compile something like <?= $service; ?> too. How should I call the database, can you shed some light on that?
– Cowgirl
Sep 28 '17 at 15:29
You are using Laravel, an MVC framework, you need to create a route to an action in your controller in this action you will call the database using eloquent and pass the result to the view which should render back HTML.
– teeyo
Sep 28 '17 at 15:31
I am aware of that too. I tried doing that, but in my case, I pass the eloquent to my view, but that specific view needs to get access to the variable in the URL from GET method, it cannot do that. Additionally, I don't want to include the navbar and other things in that view.
– Cowgirl
Sep 28 '17 at 15:36
You create your portion of the view without extending the navbar and other componenet and you put only the loop code, I don't get it how you can't access the variable ? you pass the variable to the view, wich means it will be available in the view !
– teeyo
Sep 28 '17 at 15:38
|
show 3 more comments
1
Did you know that this@foreach
is a templating engine and not PHP ? and how it is supposed to request the database for companies if you're not calling the database, and also CSS is an interpreted language so saying It compiles the CSS files is incorrect! And finally, yeah you should do the logic in your controller and then pass the result of the view to be rendered to your Ajax!
– teeyo
Sep 28 '17 at 15:25
Yes, I am aware of that. It does not compile something like <?= $service; ?> too. How should I call the database, can you shed some light on that?
– Cowgirl
Sep 28 '17 at 15:29
You are using Laravel, an MVC framework, you need to create a route to an action in your controller in this action you will call the database using eloquent and pass the result to the view which should render back HTML.
– teeyo
Sep 28 '17 at 15:31
I am aware of that too. I tried doing that, but in my case, I pass the eloquent to my view, but that specific view needs to get access to the variable in the URL from GET method, it cannot do that. Additionally, I don't want to include the navbar and other things in that view.
– Cowgirl
Sep 28 '17 at 15:36
You create your portion of the view without extending the navbar and other componenet and you put only the loop code, I don't get it how you can't access the variable ? you pass the variable to the view, wich means it will be available in the view !
– teeyo
Sep 28 '17 at 15:38
1
1
Did you know that this
@foreach
is a templating engine and not PHP ? and how it is supposed to request the database for companies if you're not calling the database, and also CSS is an interpreted language so saying It compiles the CSS files is incorrect! And finally, yeah you should do the logic in your controller and then pass the result of the view to be rendered to your Ajax!– teeyo
Sep 28 '17 at 15:25
Did you know that this
@foreach
is a templating engine and not PHP ? and how it is supposed to request the database for companies if you're not calling the database, and also CSS is an interpreted language so saying It compiles the CSS files is incorrect! And finally, yeah you should do the logic in your controller and then pass the result of the view to be rendered to your Ajax!– teeyo
Sep 28 '17 at 15:25
Yes, I am aware of that. It does not compile something like <?= $service; ?> too. How should I call the database, can you shed some light on that?
– Cowgirl
Sep 28 '17 at 15:29
Yes, I am aware of that. It does not compile something like <?= $service; ?> too. How should I call the database, can you shed some light on that?
– Cowgirl
Sep 28 '17 at 15:29
You are using Laravel, an MVC framework, you need to create a route to an action in your controller in this action you will call the database using eloquent and pass the result to the view which should render back HTML.
– teeyo
Sep 28 '17 at 15:31
You are using Laravel, an MVC framework, you need to create a route to an action in your controller in this action you will call the database using eloquent and pass the result to the view which should render back HTML.
– teeyo
Sep 28 '17 at 15:31
I am aware of that too. I tried doing that, but in my case, I pass the eloquent to my view, but that specific view needs to get access to the variable in the URL from GET method, it cannot do that. Additionally, I don't want to include the navbar and other things in that view.
– Cowgirl
Sep 28 '17 at 15:36
I am aware of that too. I tried doing that, but in my case, I pass the eloquent to my view, but that specific view needs to get access to the variable in the URL from GET method, it cannot do that. Additionally, I don't want to include the navbar and other things in that view.
– Cowgirl
Sep 28 '17 at 15:36
You create your portion of the view without extending the navbar and other componenet and you put only the loop code, I don't get it how you can't access the variable ? you pass the variable to the view, wich means it will be available in the view !
– teeyo
Sep 28 '17 at 15:38
You create your portion of the view without extending the navbar and other componenet and you put only the loop code, I don't get it how you can't access the variable ? you pass the variable to the view, wich means it will be available in the view !
– teeyo
Sep 28 '17 at 15:38
|
show 3 more comments
8 Answers
8
active
oldest
votes
Laravel 419 post error is usually related with api.php and token authorization
Laravel automatically generates a CSRF "token" for each active user session managed by the application. This token is used to verify that the authenticated user is the one actually making the requests to the application.
Add this to your ajax call
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
or you can exclude some URIs in VerifyCSRF token middleware
protected $except = [
'stripe/*',
];
add a comment |
419 error happens when you don`t post csrf_token. in your post method you must add this token along other variables.
add a comment |
In your action you need first to load companies like so :
$companies = AppCompany::all();
return view('listing.company')->with('companies' => $companies)->render();
This will make the companies variable available in the view, and it should render the HTML correctly.
Try to use postman chrome extension to debug your view.
I am doing that too, I am just using compact function to pass that companies variable to the listing.company view
– Cowgirl
Sep 28 '17 at 15:53
Well the->render()
should render the HTML, you should get a string with HTML inside, no blade tags! I'm sorry I have no Laravel installaion available so I can debug with you.
– teeyo
Sep 28 '17 at 15:55
add a comment |
I had the same issue, and it ended up being a problem with the php max post size. Increasing it solved the problem.
add a comment |
You don't have any data that you're submitting! Try adding this line to your ajax:
data: $('form').serialize(),
Make sure you change the name to match!
Also your data should be submitted inside of a form submit function.
Your code should look something like this:
<script>
$(function () {
$('form').on('submit', function (e) {
e.preventDefault();
$.ajax({
type: 'post',
url: 'company.php',
data: $('form').serialize(),
success: function () {
alert('form was submitted');
}
});
});
});
</script>
Still, he does not have any logic in the controller from what I understand :)
– teeyo
Sep 28 '17 at 15:26
I mean he does have more issues beyond just the AJAX, but he's asking about the AJAX portion of it so i'm just giving him that answer :P
– Tim Hinz
Sep 28 '17 at 15:28
add a comment |
In laravel you can use view render.
ex.
$returnHTML = view('myview')->render();
myview.blade.php contains your blade code
Even if I do render, it throws 500 error because that view does not have the access to the current URL get for the search form.
– Cowgirl
Sep 28 '17 at 15:34
remove this one dataType:'html',
– Александр Волошиновский
Sep 28 '17 at 15:36
I get unknown 419 status
– Cowgirl
Sep 28 '17 at 15:38
istead of this url : "company.php",, must be a route name, you use the Laravel MVC.
– Александр Волошиновский
Sep 28 '17 at 15:38
Yes, I am including the route name in the URL.
– Cowgirl
Sep 28 '17 at 15:41
|
show 4 more comments
I received this error when I had a config file with <?php
on the second line instead of the first.
add a comment |
Had the same problem, regenerating application key helped - php artisan key:generate
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46472812%2fajax-laravel-419-post-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
8 Answers
8
active
oldest
votes
8 Answers
8
active
oldest
votes
active
oldest
votes
active
oldest
votes
Laravel 419 post error is usually related with api.php and token authorization
Laravel automatically generates a CSRF "token" for each active user session managed by the application. This token is used to verify that the authenticated user is the one actually making the requests to the application.
Add this to your ajax call
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
or you can exclude some URIs in VerifyCSRF token middleware
protected $except = [
'stripe/*',
];
add a comment |
Laravel 419 post error is usually related with api.php and token authorization
Laravel automatically generates a CSRF "token" for each active user session managed by the application. This token is used to verify that the authenticated user is the one actually making the requests to the application.
Add this to your ajax call
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
or you can exclude some URIs in VerifyCSRF token middleware
protected $except = [
'stripe/*',
];
add a comment |
Laravel 419 post error is usually related with api.php and token authorization
Laravel automatically generates a CSRF "token" for each active user session managed by the application. This token is used to verify that the authenticated user is the one actually making the requests to the application.
Add this to your ajax call
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
or you can exclude some URIs in VerifyCSRF token middleware
protected $except = [
'stripe/*',
];
Laravel 419 post error is usually related with api.php and token authorization
Laravel automatically generates a CSRF "token" for each active user session managed by the application. This token is used to verify that the authenticated user is the one actually making the requests to the application.
Add this to your ajax call
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
or you can exclude some URIs in VerifyCSRF token middleware
protected $except = [
'stripe/*',
];
answered Sep 29 '17 at 16:42
DhirajDhiraj
1,383623
1,383623
add a comment |
add a comment |
419 error happens when you don`t post csrf_token. in your post method you must add this token along other variables.
add a comment |
419 error happens when you don`t post csrf_token. in your post method you must add this token along other variables.
add a comment |
419 error happens when you don`t post csrf_token. in your post method you must add this token along other variables.
419 error happens when you don`t post csrf_token. in your post method you must add this token along other variables.
answered Nov 7 '18 at 12:14
Adnan RasheedAdnan Rasheed
23423
23423
add a comment |
add a comment |
In your action you need first to load companies like so :
$companies = AppCompany::all();
return view('listing.company')->with('companies' => $companies)->render();
This will make the companies variable available in the view, and it should render the HTML correctly.
Try to use postman chrome extension to debug your view.
I am doing that too, I am just using compact function to pass that companies variable to the listing.company view
– Cowgirl
Sep 28 '17 at 15:53
Well the->render()
should render the HTML, you should get a string with HTML inside, no blade tags! I'm sorry I have no Laravel installaion available so I can debug with you.
– teeyo
Sep 28 '17 at 15:55
add a comment |
In your action you need first to load companies like so :
$companies = AppCompany::all();
return view('listing.company')->with('companies' => $companies)->render();
This will make the companies variable available in the view, and it should render the HTML correctly.
Try to use postman chrome extension to debug your view.
I am doing that too, I am just using compact function to pass that companies variable to the listing.company view
– Cowgirl
Sep 28 '17 at 15:53
Well the->render()
should render the HTML, you should get a string with HTML inside, no blade tags! I'm sorry I have no Laravel installaion available so I can debug with you.
– teeyo
Sep 28 '17 at 15:55
add a comment |
In your action you need first to load companies like so :
$companies = AppCompany::all();
return view('listing.company')->with('companies' => $companies)->render();
This will make the companies variable available in the view, and it should render the HTML correctly.
Try to use postman chrome extension to debug your view.
In your action you need first to load companies like so :
$companies = AppCompany::all();
return view('listing.company')->with('companies' => $companies)->render();
This will make the companies variable available in the view, and it should render the HTML correctly.
Try to use postman chrome extension to debug your view.
answered Sep 28 '17 at 15:50
teeyoteeyo
2,36821531
2,36821531
I am doing that too, I am just using compact function to pass that companies variable to the listing.company view
– Cowgirl
Sep 28 '17 at 15:53
Well the->render()
should render the HTML, you should get a string with HTML inside, no blade tags! I'm sorry I have no Laravel installaion available so I can debug with you.
– teeyo
Sep 28 '17 at 15:55
add a comment |
I am doing that too, I am just using compact function to pass that companies variable to the listing.company view
– Cowgirl
Sep 28 '17 at 15:53
Well the->render()
should render the HTML, you should get a string with HTML inside, no blade tags! I'm sorry I have no Laravel installaion available so I can debug with you.
– teeyo
Sep 28 '17 at 15:55
I am doing that too, I am just using compact function to pass that companies variable to the listing.company view
– Cowgirl
Sep 28 '17 at 15:53
I am doing that too, I am just using compact function to pass that companies variable to the listing.company view
– Cowgirl
Sep 28 '17 at 15:53
Well the
->render()
should render the HTML, you should get a string with HTML inside, no blade tags! I'm sorry I have no Laravel installaion available so I can debug with you.– teeyo
Sep 28 '17 at 15:55
Well the
->render()
should render the HTML, you should get a string with HTML inside, no blade tags! I'm sorry I have no Laravel installaion available so I can debug with you.– teeyo
Sep 28 '17 at 15:55
add a comment |
I had the same issue, and it ended up being a problem with the php max post size. Increasing it solved the problem.
add a comment |
I had the same issue, and it ended up being a problem with the php max post size. Increasing it solved the problem.
add a comment |
I had the same issue, and it ended up being a problem with the php max post size. Increasing it solved the problem.
I had the same issue, and it ended up being a problem with the php max post size. Increasing it solved the problem.
answered Nov 6 '18 at 14:02
Francisco IsidoriFrancisco Isidori
114
114
add a comment |
add a comment |
You don't have any data that you're submitting! Try adding this line to your ajax:
data: $('form').serialize(),
Make sure you change the name to match!
Also your data should be submitted inside of a form submit function.
Your code should look something like this:
<script>
$(function () {
$('form').on('submit', function (e) {
e.preventDefault();
$.ajax({
type: 'post',
url: 'company.php',
data: $('form').serialize(),
success: function () {
alert('form was submitted');
}
});
});
});
</script>
Still, he does not have any logic in the controller from what I understand :)
– teeyo
Sep 28 '17 at 15:26
I mean he does have more issues beyond just the AJAX, but he's asking about the AJAX portion of it so i'm just giving him that answer :P
– Tim Hinz
Sep 28 '17 at 15:28
add a comment |
You don't have any data that you're submitting! Try adding this line to your ajax:
data: $('form').serialize(),
Make sure you change the name to match!
Also your data should be submitted inside of a form submit function.
Your code should look something like this:
<script>
$(function () {
$('form').on('submit', function (e) {
e.preventDefault();
$.ajax({
type: 'post',
url: 'company.php',
data: $('form').serialize(),
success: function () {
alert('form was submitted');
}
});
});
});
</script>
Still, he does not have any logic in the controller from what I understand :)
– teeyo
Sep 28 '17 at 15:26
I mean he does have more issues beyond just the AJAX, but he's asking about the AJAX portion of it so i'm just giving him that answer :P
– Tim Hinz
Sep 28 '17 at 15:28
add a comment |
You don't have any data that you're submitting! Try adding this line to your ajax:
data: $('form').serialize(),
Make sure you change the name to match!
Also your data should be submitted inside of a form submit function.
Your code should look something like this:
<script>
$(function () {
$('form').on('submit', function (e) {
e.preventDefault();
$.ajax({
type: 'post',
url: 'company.php',
data: $('form').serialize(),
success: function () {
alert('form was submitted');
}
});
});
});
</script>
You don't have any data that you're submitting! Try adding this line to your ajax:
data: $('form').serialize(),
Make sure you change the name to match!
Also your data should be submitted inside of a form submit function.
Your code should look something like this:
<script>
$(function () {
$('form').on('submit', function (e) {
e.preventDefault();
$.ajax({
type: 'post',
url: 'company.php',
data: $('form').serialize(),
success: function () {
alert('form was submitted');
}
});
});
});
</script>
<script>
$(function () {
$('form').on('submit', function (e) {
e.preventDefault();
$.ajax({
type: 'post',
url: 'company.php',
data: $('form').serialize(),
success: function () {
alert('form was submitted');
}
});
});
});
</script>
<script>
$(function () {
$('form').on('submit', function (e) {
e.preventDefault();
$.ajax({
type: 'post',
url: 'company.php',
data: $('form').serialize(),
success: function () {
alert('form was submitted');
}
});
});
});
</script>
edited Sep 28 '17 at 15:27
answered Sep 28 '17 at 15:22
Tim HinzTim Hinz
29718
29718
Still, he does not have any logic in the controller from what I understand :)
– teeyo
Sep 28 '17 at 15:26
I mean he does have more issues beyond just the AJAX, but he's asking about the AJAX portion of it so i'm just giving him that answer :P
– Tim Hinz
Sep 28 '17 at 15:28
add a comment |
Still, he does not have any logic in the controller from what I understand :)
– teeyo
Sep 28 '17 at 15:26
I mean he does have more issues beyond just the AJAX, but he's asking about the AJAX portion of it so i'm just giving him that answer :P
– Tim Hinz
Sep 28 '17 at 15:28
Still, he does not have any logic in the controller from what I understand :)
– teeyo
Sep 28 '17 at 15:26
Still, he does not have any logic in the controller from what I understand :)
– teeyo
Sep 28 '17 at 15:26
I mean he does have more issues beyond just the AJAX, but he's asking about the AJAX portion of it so i'm just giving him that answer :P
– Tim Hinz
Sep 28 '17 at 15:28
I mean he does have more issues beyond just the AJAX, but he's asking about the AJAX portion of it so i'm just giving him that answer :P
– Tim Hinz
Sep 28 '17 at 15:28
add a comment |
In laravel you can use view render.
ex.
$returnHTML = view('myview')->render();
myview.blade.php contains your blade code
Even if I do render, it throws 500 error because that view does not have the access to the current URL get for the search form.
– Cowgirl
Sep 28 '17 at 15:34
remove this one dataType:'html',
– Александр Волошиновский
Sep 28 '17 at 15:36
I get unknown 419 status
– Cowgirl
Sep 28 '17 at 15:38
istead of this url : "company.php",, must be a route name, you use the Laravel MVC.
– Александр Волошиновский
Sep 28 '17 at 15:38
Yes, I am including the route name in the URL.
– Cowgirl
Sep 28 '17 at 15:41
|
show 4 more comments
In laravel you can use view render.
ex.
$returnHTML = view('myview')->render();
myview.blade.php contains your blade code
Even if I do render, it throws 500 error because that view does not have the access to the current URL get for the search form.
– Cowgirl
Sep 28 '17 at 15:34
remove this one dataType:'html',
– Александр Волошиновский
Sep 28 '17 at 15:36
I get unknown 419 status
– Cowgirl
Sep 28 '17 at 15:38
istead of this url : "company.php",, must be a route name, you use the Laravel MVC.
– Александр Волошиновский
Sep 28 '17 at 15:38
Yes, I am including the route name in the URL.
– Cowgirl
Sep 28 '17 at 15:41
|
show 4 more comments
In laravel you can use view render.
ex.
$returnHTML = view('myview')->render();
myview.blade.php contains your blade code
In laravel you can use view render.
ex.
$returnHTML = view('myview')->render();
myview.blade.php contains your blade code
answered Sep 28 '17 at 15:29
Александр ВолошиновскийАлександр Волошиновский
9111
9111
Even if I do render, it throws 500 error because that view does not have the access to the current URL get for the search form.
– Cowgirl
Sep 28 '17 at 15:34
remove this one dataType:'html',
– Александр Волошиновский
Sep 28 '17 at 15:36
I get unknown 419 status
– Cowgirl
Sep 28 '17 at 15:38
istead of this url : "company.php",, must be a route name, you use the Laravel MVC.
– Александр Волошиновский
Sep 28 '17 at 15:38
Yes, I am including the route name in the URL.
– Cowgirl
Sep 28 '17 at 15:41
|
show 4 more comments
Even if I do render, it throws 500 error because that view does not have the access to the current URL get for the search form.
– Cowgirl
Sep 28 '17 at 15:34
remove this one dataType:'html',
– Александр Волошиновский
Sep 28 '17 at 15:36
I get unknown 419 status
– Cowgirl
Sep 28 '17 at 15:38
istead of this url : "company.php",, must be a route name, you use the Laravel MVC.
– Александр Волошиновский
Sep 28 '17 at 15:38
Yes, I am including the route name in the URL.
– Cowgirl
Sep 28 '17 at 15:41
Even if I do render, it throws 500 error because that view does not have the access to the current URL get for the search form.
– Cowgirl
Sep 28 '17 at 15:34
Even if I do render, it throws 500 error because that view does not have the access to the current URL get for the search form.
– Cowgirl
Sep 28 '17 at 15:34
remove this one dataType:'html',
– Александр Волошиновский
Sep 28 '17 at 15:36
remove this one dataType:'html',
– Александр Волошиновский
Sep 28 '17 at 15:36
I get unknown 419 status
– Cowgirl
Sep 28 '17 at 15:38
I get unknown 419 status
– Cowgirl
Sep 28 '17 at 15:38
istead of this url : "company.php",, must be a route name, you use the Laravel MVC.
– Александр Волошиновский
Sep 28 '17 at 15:38
istead of this url : "company.php",, must be a route name, you use the Laravel MVC.
– Александр Волошиновский
Sep 28 '17 at 15:38
Yes, I am including the route name in the URL.
– Cowgirl
Sep 28 '17 at 15:41
Yes, I am including the route name in the URL.
– Cowgirl
Sep 28 '17 at 15:41
|
show 4 more comments
I received this error when I had a config file with <?php
on the second line instead of the first.
add a comment |
I received this error when I had a config file with <?php
on the second line instead of the first.
add a comment |
I received this error when I had a config file with <?php
on the second line instead of the first.
I received this error when I had a config file with <?php
on the second line instead of the first.
answered Dec 12 '18 at 15:25
elieli
100213
100213
add a comment |
add a comment |
Had the same problem, regenerating application key helped - php artisan key:generate
add a comment |
Had the same problem, regenerating application key helped - php artisan key:generate
add a comment |
Had the same problem, regenerating application key helped - php artisan key:generate
Had the same problem, regenerating application key helped - php artisan key:generate
answered Jan 31 at 10:25
EXayerEXayer
336
336
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46472812%2fajax-laravel-419-post-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Did you know that this
@foreach
is a templating engine and not PHP ? and how it is supposed to request the database for companies if you're not calling the database, and also CSS is an interpreted language so saying It compiles the CSS files is incorrect! And finally, yeah you should do the logic in your controller and then pass the result of the view to be rendered to your Ajax!– teeyo
Sep 28 '17 at 15:25
Yes, I am aware of that. It does not compile something like <?= $service; ?> too. How should I call the database, can you shed some light on that?
– Cowgirl
Sep 28 '17 at 15:29
You are using Laravel, an MVC framework, you need to create a route to an action in your controller in this action you will call the database using eloquent and pass the result to the view which should render back HTML.
– teeyo
Sep 28 '17 at 15:31
I am aware of that too. I tried doing that, but in my case, I pass the eloquent to my view, but that specific view needs to get access to the variable in the URL from GET method, it cannot do that. Additionally, I don't want to include the navbar and other things in that view.
– Cowgirl
Sep 28 '17 at 15:36
You create your portion of the view without extending the navbar and other componenet and you put only the loop code, I don't get it how you can't access the variable ? you pass the variable to the view, wich means it will be available in the view !
– teeyo
Sep 28 '17 at 15:38