Sending an e-mail using Laravel and jQuery
When creating a contact form, we may choose to let the user send the form asynchronously. Using Laravel and jQuery, we can have the form submitted without needing the user to go to a different page.
Getting ready
For this recipe, we need a standard Laravel installation and our mail client properly configured. We can update our mail configuration in the app/config/mail.php
file.
How to do it...
To complete this recipe, follow the given steps:
In the
views
directory, create a file namedemailform.php
as shown in the following code:<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title></title> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> </head> <body> <div id="container"> <div id="error"></div> <form id="email-form"> <label>To: </label> <input name="to" type="email"><br...