0
我試圖在Laravel中找到一條郵件路由,並且它給出了一個500錯誤。我嘗試了不同的路線,它的工作原理.. 請注意,我們最近添加了ssl的網站。在Ajax請求期間發生500錯誤
在Chrome瀏覽器開發工具的錯誤消息
jquery.js:4 POST https://murgency.com/saveRequestInfo 500 (Internal Server Error)
的HTML代碼: -
<div class="form-group text-right">
<a href="" type="button" class="btn-sm-arrowhead" id="dwnBrochure"
title="Download Brochure">Download Brochure</a>
</div>
jQuery代碼: -
$('#dwnBrochure').click(function (e) {
var text_name = $('#txt_name').val();
var countryCode = $('#countryCode option:selected').text();
var text_number = $('#txt_number').val();
var text_email = $('#txt_email').val();
var package = $('#packagetype').val();
var type = "agingParents";
var url = '/saveRequestInfo';
var data = {
name: text_name,
email: text_email,
countryCode: countryCode,
phone: text_number,
package: package,
type: type
};
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
url: url,
data: data,
type: 'POST',
datatype: 'JSON',
success: function (response) {
if (response.status === true) {
window.location = "https://murgency.com/home-health-plans/senior/brochure-success";
}
else {
alert('failure');
}
},
error: function (response) {
}
});
e.preventDefault();
});
routes.php文件
Route::post('saveRequestInfo', '[email protected]');
ServicesController代碼: - 錯誤的
public function saveRequestInfo(Request $request)
{
$data = $request->input();
$object = new ParseObject("MedicalRequest");
$object->set('name', $data['name']);
$object->set('email', $data['email']);
$object->set('package', $data['package']);
$object->set('phone', $data['countryCode'] . $data['phone']);
$object->set('type', $data['type']);
try
{
$object->save();
$status = true;
} catch (ParseException $ex)
{
$status = false;
}
$this->sendBrochureEmail($data['email'], $data['name']);
return Response::json(['status' => $status, 'message' => $data['name']]);
}
你檢查這http://stackoverflow.com/questions/30154489/ajax-post-in-laravel-5-return-error-500-internal-server-error? –
查看您的Laravel /服務器日誌以瞭解500是由什麼引起的。 –
失敗是在響應中..我檢查出來..我會在5-10分鐘確認..請堅持.. –