How do I get the form response to load into a different div?
I am testing out my first jqm + jquery app and I can get this form to submit fine, but when it gets submitted, I want the page to change to the descriptions div. It's not doing that right now. I tried to add action="#descriptions" in the form but that didn't work either.
<script>
$(document).ready(function() {
$("#testForm").submit(sendForm)
});
function sendForm() {
$.post('http://www.myurl.com/mobile_test.cfm',
$("#testForm").serialize(),
function(data,status){
$("#descriptions").html(data)
});
return false
}
</script>
<div data-role="fieldcontain">
<form id="testForm">
<label for="name">Name:</label> <input name="name" type="text" data-theme="c"><br/>
<label for="email">Email:</label> <input name="email" type="text" data-theme="c"><br/>
<label for="gender">Gender:</label>
<select name="gender" data-theme="c">
<option value="M">Male</option>
<option value="F">Female</option>
</select><br/>
<input type="submit" value="Save" data-theme="b" />
</form>
</div>
<div data-role="page" id="descriptions">
<div data-role="header">
<a href="javascript: window.history.go(-1)" data-icon="arrow-l" data-role="button" data-theme="b">Back</a>
<h1>Descriptions</h1>
<a href="#homepage" data-icon="home" data-role="button" data-theme="b">Home</a>
</div>
<div data-role="content" data-theme="c">
Testin descr
</div>
<div data-role="footer">
<h4>© MySite - 2013</h4>
</div>
</div>