Your structure should be like this if doing holistic approach (html5 to native via Titanium/Phonegap)
/projects/apps/html5app/index.html
/projects/apps/html5app/contact.html
/projects/apps/html5app/assets/js/phonegap.js
/projects/apps/html5app/assets/js/jquery.js
/projects/apps/html5app/assets/css/css.css
/projects/apps/html5app/assets/images/logo.jpg
/projects/apps/html5app/assets/images/button.jpg
in contact.html you need to point to a live server with the PHP file
<form action="https://service.cdn-app.com/contact-form.php" method="get">
And then use a postback to submit a thanks page in AJAX or JSON so the user is not prompted to leave the app.
Alternatively UPDATE - Easier approach is just do button like this
<input type="button" onclick="submit()" value="submit contact"/>
Then on your jQuery you can do the action their (they won't leave your app and you can trigger a replace div with thanks etc)
// Start the jQuery form process engine
jQUERY Sample
$.post('https://service.cdn-app.com/contact-form.php', {
// These are the names of the form values
FirstName: $('#FirstName_input').val(),
LastName: $('#LastName_input').val(),
Email: $('#Email_input').val(),
MessageText: $('#MessageText_input').val()
// HTML function
}, function (html) {
// Place the HTML in a astring
var response=html;
// PHP was done and email sent
if (response=="success") {
alert("Message sent!");
} else {
// Error postback
alert("Sorry please fill all fields!");
return false;
}
});
PHP SAMPLE
<?php
// VARS
$FirstName=$_GET["FirstName"];
$LastName=$_GET["LastName"];
$Email=$_GET["Email"];
$MessageText=$_GET["MessageText"];
$Headers = "From:" . $Email;
//VALIDATION
if(
$FirstName=="" ||
$LastName=="" ||
$Email=="" ||
$MessageText==""
) {
echo "Error";
} else {
mail("[email protected]","mobile app message",$MessageText, $Headers);
echo "Success";
}
?>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…