Last active
December 18, 2015 09:59
-
-
Save hilukasz/5765520 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.questionFive').click(function(){ | |
$.post("../mail.php", preSubmit()) | |
}); | |
// this returns a string | |
function preSubmit(){ | |
var optionTexts = []; | |
$("section").each(function(){ | |
var h2 = $(this).find("h2").text(); | |
optionTexts.push(h2) | |
$("ol li", this).each(function() { optionTexts.push($(this).text()) }) | |
optionTexts.push("\n") | |
}); | |
var optionString = optionTexts.toString(); | |
var splitText = optionString.split(","); | |
alert(splitText) | |
return {"mailstring":splitText}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (isset($_POST['mailstring']) { | |
$mail = $_POST['mailstring']; | |
mail('lukasz@visualhero.com', 'My Subject', $mail); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment