我正在做一個簡單的表單submit.On表單提交我有表單action =「Facility.aspx」.on Facility.aspx我使用dialog popups.after表單提交這些對話框不起作用,但他們在提交表單之前工作。PopUp對話框在表單提交後jquery手機不工作
首先HTML表單:
<html>
<head>
<title>Facility</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script>
</head>
<body>
<div data-role="page" id="arealistpage">
<div data-role="header" data-theme="b">
<a href="Facility.aspx" class='ui-btn-left ui-btn-back' data-icon='arrow-l' rel="external">Back</a>
</div><!-- /header -->
<div data-role="content">
<form id="form1" method="post">
<div id="AreaNoDiv" data-role="fieldcontain" class="field">
<label for="Facility">Facility*</label>
<input id="Facility" name="shipNo_r" type="text" required/>
</div>
<div id="desDiv" data-role="fieldcontain" class="field">
<label for="des" id="Label1" name="fnameLabel">Description*</label>
<input id="des" name="fname_r" type="text" required/>
</div>
<div id="submitDiv" data-role="fieldcontain" style="width: 30%">
<button class="btnLogin" data-theme="b" type="submit" id='mysubmit'>submit</button>
</div>
</form>
</div><!-- /content -->
<div data-role="footer" data-theme="b" data-position="fixed">
<div data-role="navbar">
<ul>
<li><a href="" data-role="tab" data-icon="arrow-u" class="returnTopAction">Top</a></li>
</ul>
</div>
</div>
</div><!-- /page -->
<script src="Submitscript.js" type="text/javascript"></script>
</body>
</html>
腳本:
$('#arealistpage').live('pageshow',function(event){
var serviceURL = 'service1.asmx/SubmitList';
$('#mysubmit').bind('click', function(e){
$.ajax({
type: "POST",
url: serviceURL,
data: '{"name":"' + name + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: successFunc,
error: errorFunc
});
});
function successFunc(data, status) {
// parse it as object
// var outStr = JSON.parse(data.d);
// alert(outStr);
}
function errorFunc() {
alert('error');
}
});
我的第二個從哪裏對話框不工作表單提交後。
<html>
<head>
<title>Facility</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script>
<script type="text/javascript">
$('#arealistpage').live('pageshow', function (event) {
$('div[id="primaryList"] ul[data-role="listview"] a').bind("click", function() {
var facilityid = $(this).data("facilityid");
sessionStorage.facilityid = facilityid;
});
});
</script>
</head>
<body>
<div data-role="page" id="arealistpage">
<div data-role="header" data-theme="b">
<h1><a name="top"></a>Facility</h1>
<a href="../MenuePages/Dictionaries.aspx" class='ui-btn-left ui-btn-back' data-icon='arrow-l' rel="external">Back</a>
<a href="AddFacility.aspx" data-role="button" data-icon="plus" data-theme="d" style="float:left;" rel="external" data-transition="slide" data-ajax="false">Add</a>
</div><!-- /header -->
<div data-role="content">
<div id="primaryList">
<ul data-role="listview" data-inset="true" data-theme="c" data-filter="true" id="areaList" data-split-icon="gear" data-split-theme="d">
</ul>
</div>
</div><!-- /content -->
<div data-role="footer" data-theme="b" data-position="fixed">
<div data-role="navbar">
<ul>
<li><a href="" data-role="tab" data-icon="arrow-u" class="returnTopAction">Top</a></li>
</ul>
</div>
</div>
<script src="FacilityScript.js" type="text/javascript"></script>
</div><!-- /page -->
<div data-role="page" id="dialog">
<div data-role="header" data-theme="b">
<h1>Options</h1>
</div>
<ul data-role="listview" data-inset="false"
data-theme="c">
<li data-icon="false"><a href="UpdateFacility.aspx" data-ajax="false">Edit</a></li>
<li data-icon="false"><a href="#divMsg" data-rel="dialog" data-transition="pop">Delete</a></li>
</ul>
</div>
<div data-role="page" id="divMsg">
<div data-role="header" data-theme="b">
<h1>Confirmation</h1>
</div>
<div data-role="content">
<a href="Facility.aspx" onclick="DeleteFacility(); return true" data-role="button" data-ajax="false">Delete Record?</a>
</div>
<script src="FacilityScript.js" type="text/javascript"></script>
</div>
</body>
</html>
Facility.js
我會檢查並getback你 – 2013-03-07 04:09:10
謝謝朋友! – chamara 2013-03-07 04:11:41
你在腳本'FacilityScript.js'中有什麼? – 2013-03-07 06:04:32