I want send the data 'home_page' page to 'get_data' page.how to get the data from home page and send to the second page using jquery
<div class="main">
<!-- first page -->
<section id="home_page" data-role="page">
<header data-role="header">
<h1>Header</h1>
</header><!-- /header -->
<article role="main" class="ui-content">
<!-- Form -->
<form action="" method="post" accept-charset="utf-8">
form data send here
</form>
</article><!-- /content -->
<footer data-role="footer">
<h1>Footer</h1>
</footer><!-- /footer -->
</section><!-- second page -->
<section id="get_data" data-role="page">
<header data-role="header">
<h1>Header</h1>
</header><!-- /header -->
<article role="main" class="ui-content">
<p> display the data here from home page </p>
</article><!-- /content -->
<footer data-role="footer">
<h1>Footer</h1>
</footer><!-- /footer -->
</section><!-- /page -->
</div>
最佳答案
您可以获取第 1 页上的表单数据并将表单值附加到第 2 页。完成后,您可以根据需要更改页面。在演示中,“提交”按钮转到第二页。
代码
$("#sub").on( "click", function( event ) {
var first = $('#first').val();
var last = $('#last').val();
$("#formdata").empty();
var pagedata = $("<p>" + first + "</p><p>" + last + "</p>");
pagedata.appendTo("#formdata");
$("#formdata").enhanceWithin();
$( ":mobile-pagecontainer" ).pagecontainer( "change", "#get_data", { transition: "pop" } );
})
演示
关于javascript - Jquery移动表单数据在单个文件中的两个页面之间提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26059383/