【发布时间】:2016-11-02 12:27:34
【问题描述】:
我想在 laravel 5.3 的 jquery 页面中调用邮件功能。我的邮件路由器名称为 'welcome-mail'
Route::get('welcome-mail','travelerHome@welcomeMail');
Controller
public function welcomeMail()
{
$to_email = 'sample@domain.com';
Mail::to($to_email)->send(new Reminder);
//return "E-mail has been sent Successfully";
}
mail/Remainder.php
public function build()
{
return $this->from('sample@toDomain.com')
->view('email.welcome');
}
view/email/welcome.blade.php
<html>
<body>
<h3>Hi,</h3>
<p>Test mail Travel approval</p>
</body>
</html>
我想在 json 响应或者 json url 中调用这个函数
if(approve_id=='Y'){
var status = 'approved';
$.ajax({
url: 'request-status',
type: 'GET',
data: {'id':user_id,'status':status,'comment':comment},
dataType: 'JSON',
success: function(data, textStatus, jqXHR){
//alert(data);
url: 'welcome-mail' //want to call like this
$(".table-responsive").load(location.href + " .table-responsive");
},
error: function(jqXHR, textStatus, errorThrown){
// alert('errror');
},
});
}
【问题讨论】:
标签: php jquery json laravel email