Answer the question
In order to leave comments, you need to log in
Where to look if assets does not compile and trace does not help?
[email protected]:/var/www/apps/testapp# rake assets:precompile RAILS_ENV=production --trace
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
Answer the question
In order to leave comments, you need to log in
More recent versions of sprockets-rails, sass-rails, rails helped
Perhaps you have a lot of things to compile, which is why it takes so long.
You need to specify the handler and data transfer method for the form, above in your code, the handler is the email.php file in the root directory of the site:
Send data using ajax, check if the fields are full, for this you need the jquery library and the script file itself, for example script.js located in the js folder in the root of the site.
Connect them to the head:
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="/js/script.js"></script>
$(document).ready(function(){
$('#contact-form').submit(function(){
var subject = $(this).find("#subject :selected").text();
var name = $(this).find("#name").val();
var email = $(this).find("#email").val();
var message = $(this).find("#message").val();
if(!!name && !!email && !!message){
$.ajax({
type: "POST",
url: "/email.php",
data: {"subject": subject, "name": name,"email": email, "message": message},
cache: false,
success: function(){
/* действия при успешной отправке */
}
})
}
return false;
});
});
<? header("Content-type: text/html; charset=utf-8");
$text = "<b>subject</b>: ".$_POST['subject']."<br>";
$text .= "<b>name</b>: ".$_POST['name']."<br>" ;
$text .= "<b>email</b>: ".$_POST['email']."<br>";
$text .= "<b>message</b>: ".$_POST['message']."<br>";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
mail('[email protected]', 'Заголовок письма', $text, $headers);
?>
You must have been looking for an e-mail sending script, but found an e-mail sending form.
Search Google for "php email send script".
And make sure that php is executed in your file, that is, your file must be with the .php extension, php must be installed on the hosting (or on your server).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question