より大きなシングルページアプリケーションの一部である次の機能があります。
gatherData function(){
var superarray = []
var row = 0
$('ul li').each(function(){
var task = $(this).find('.edited').html();
var time = $(this).find('.time').html();
var array = []
var count = 0
array[count] = task;
count = count + 1
array[count] = time;
superarray[row] = array
row = row + 1
}); // end each
console.log(superarray); // this is the data i want tabulated in email
});
使いたいです
<form><email><submit class="send"></form>
$('.send').click(function(){
gatherData();
$.post("processform.php", // now I'm stuck
php / ajax / json /の最も適切な組み合わせでメールを送信するには、次の形式のメッセージを生成します
「データ収集の結果は
task1 time1
task2 time2
taskN taskN
ロールクレジットなど」
私の知らないうちに、投稿する前に、非表示のメッセージフィールドを作成し、DOMを介してこれにデータを追加することを考えました。しかし、もっとエレガントな方法があるに違いないと思いました。
誰かがこれに関するベストプラクティス(または作業コード!:)を提案し、この場合にどのテクノロジー/テクニックが最も適切であるかを正しい方向に向けることができますか?ありがとうございました