我正在学习围绕Jquery Mobile的方式,但我在使用jq移动对话框选项确认表单提交时遇到困难。 Wheneven我尝试从我的对话框启动我的runSearch()函数我得到一个“Error Loading Page”消息,如果我直接从srch.asp运行runSearch()函数,页面加载就好了。我正在研究jqmobile的每日构建。确认表单在Jquery Mobile中提交对话框
这是我到目前为止有:
srch.asp:
<!DOCTYPE html>
<html>
<head>
<title>Filter page</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<link href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script src="http://code.jquery.com/mobile/latest/jquery.mobile.min.js"></script>
</head>
<body >
<div data-role="page" data-add-back-btn="true" id="main">
<div data-role="header" data-theme="b" data-position="inline">
<title>Filter page</title>
<script language="JavaScript" type="text/javascript">
var count = 26;
function doSearch(){
//var sqlStr = generateSQL();
var sqlStr = 'xxx';
document.getElementById('sqlSrch').value = sqlStr;
if (count > 25){
$("#lnkDialog").click();
}
else{
runSearch();
}
}
function runSearch(){
$.mobile.changePage("/mobile/famName/results/en", {
type: "post",
data: $("form#frmSelectors").serialize()
});
}
</script>
</div><!-- /header -->
<div data-role="content">
<form id='frmSelectors' method="post" action="/mobile/famName/results/en">
<input type="hidden" name="sqlSrch" id="sqlSrch" />
<input type="hidden" name="famID" value="xxx" />
bunch more inputs go here....
<input type="button" value="Search" id='srch' onclick="doSearch()" style="srcButton"/>
<a id='lnkDialog' href="#toomany.asp" data-rel="dialog" data-transition="pop"></a>
</form>
</div><!-- /content -->
</div><!-- /page -->
</body>
</html>
toomany.asp:
<!DOCTYPE html>
<html>
<head>
<title>Warning</title>
<link href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script src="http://code.jquery.com/mobile/latest/jquery.mobile.min.js"></script>
</head>
<body>
<div data-role="dialog" id="dialog">
<div data-role="header">
<h1>Warning</h1>
</div>
<div data-role="content" data-theme="b">
<div id="text">Error Message</div>
<a href="#" data-role="button" data-rel="back" data-transition="slidedown" data-theme="b">Yes</a>
<a href="#" onclick="runSearch();" data-role="button" data-rel="dialog" data-transition="slidedown" data-theme="c">No</a>
</div>
</div>
</body>
</html>
尝试加入返回false; runSearch(); –
如果你打算使用jquerymobile,我会建议你更多的使用jquery。它很棒,在你的代码中有一些地方可以派上用场! – Evan
添加返回false;之后runSearch();调用toomany.asp没有解决这个问题,也没有向runSearch函数添加返回false。 –