I am using laravel 4.2
die(View::make('amendments.changesPopUp', $this->data));
This is the code that I am using to get the view for an ajax
call. This is working for my local machine running on windows but this is not working for server( unix ). Any idea as to why this is hapening?
and yes the I have checked the lowercase and upper case, the cases for the filename matches. and the weird thing is the error points to the line 0 of the controller
that it is using.
This is the error that I get
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Method Illuminate\\View\\View::__toString() must not throw an exception","file":"mysite.com/app/controllers/myController.php","line":0}}
Update: This worked when I used simple php file instead of a blade template. I still do not know what caused the error?
As mentioned already, don't use die() for other than debugging purposes.
Another thing to note is that because PHP's error handling for __toString
implementations is really bad (no stack traces etc), use echo View::make(...)->render()
instead of just echo View::make(...)
to get more descriptive errors - though in your case you can replace echo with die.
But again, don't use die.
You should never die()
out an input. Laravel expects to handle the response, and you are short circuiting the framework by using die()
.
Your response should simply be
return View::make('amendments.changesPopUp', $this->data);
That will then only print the changesPopUp
file - which will be correctly interrepted by the browser for the AJAX call.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With