I am trying to submit a form in an Eclipse Android emulator using Phonegap and Jquery Mobile. I am looking to submit the form and have a message showing that the form was submitted successfully or not. If I submit the form on an internet browser, the php page works fine. However, trying to use the Android emulator, the form submission never gets to the php file.
Below is the html form that I am using. I have included the phonegap and jquery scripts.
<form id="myForm" >
<div data-role="fieldcontain">
<fieldset data-role="controlgroup" data-mini="true">
<label for="textinput1">
Name
</label>
<input id="fullnameid" name="fullname" placeholder="" value="" type="text" />
</fieldset>
</div>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup" data-mini="true">
<label for="textinput2">
E-Mail
</label>
<input id="emailid" name="email" placeholder="" value="" type="text" />
</fieldset>
</div>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<label for="textarea1">
Message
</label>
<textarea id="commentid" name="comment" placeholder="" data-mini="true"></textarea>
</fieldset>
</div>
<h3 id="return"></h3>
<button data-theme="b" id="submitid" data-icon="arrow-r" data-iconpos="left" name="submit" type="submit">Submit</button>
</form>
The javascript that I am using, which is an AJAX post is:
<script>
function onSuccess(data, status)
{
data = $.trim(data);
$("#return").text(data);
}
function onError(data, status)
{
// handle an error
alert("Error Submitting Form");
}
$(document).ready(function() {
$("#submitid").click(function(){
var formData = $("#myForm").serialize();
$.ajax({
type: "POST",
url: "http://www.dowlingnetworks.com/app/contactscript.php",
cache: false,
data: formData,
success: onSuccess,
error: onError
});
return false;
});
});
</script>
Any help would be greatly appreciated.