1
回答
jquery mobile的ajax请求只有在页面刷新之后才能执行?
终于搞明白,存储TCO原来是这样算的>>>   

为什么我第一次点击这个链接,改变select的option值无法使用Ajax请求,再刷新一次之后就能使用了?


另外还有一个问题,下拉选项在Android chrome上表现非常好,但是在uc浏览器上却无法显示select的下拉选项? 


<!doctype html>
<html>
	<head>
		<meta charset="utf-8" />
<meta author="longkai" />
<meta email="im.longkai@gmail.com" />
<link rel="stylesheet" href="/resources/css/jquery-mobile/default/themes/lk.min.css" />
<link rel="stylesheet" href="/resources/css/jquery-mobile/default/jquery.mobile.structure-1.2.0.min.css" />
<script src="/resources/js/jquery/1.8.2/jquery.min.js"></script>
<script src="/resources/js/lib/jquery-mobile/1.2.0/min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
		
	</head>
<body>
	<div data-role="page">
		<div data-role="header">
		  <h1>发表新帖子</h1>
		</div>
  
		<div data-role="content">
	   		<form action="/ng/m/topic/submit" method="post" data-transition="slide" data-ajax="false">
		    	<div data-role="fieldcontain">
			        <label for="areaId">分区:</label>
			        <select name="areaId" id="areaId">
			        	<option value="0">请选择主题所要发表在的分区</option>
			        	<option value="1">xx1</option>
			        	
			        		<option value="2">xx2</option>
			        	
			        		<option value="3">xx3</option>

			        </select>
		        </div>

		        <div data-role="fieldcontain">
			        <label for="forumId">板块:</label>
			        <select name="forumId" id="forumId" data-overlay-theme="e">
			        	<option value="0">请选择主题所要发表在的板块</option>
			        </select>
		        </div>

		        <div data-role="fieldcontain">
			        <label for="title">标题:</label>
			        <input type="text" name="title" id="title" value="" required />
		        </div>
		       
				<div data-role="fieldcontain">
				    <label for="content">帖子内容:</label>
			        <textarea name="content" id="content"></textarea>
		        </div>

			    <div data-role="fieldcontain">
			        <label for="zt">转帖or原创</label>
			        <select name="zt" id="zt" data-role="slider">
				        <option value="false">原创</option>
				        <option value="true">转帖</option>
			        </select>
		        </div>
		        <input type="submit" value="发表!" data-theme="a">
		    </form>
		    <button onclick="f()">click!</button>
		</div>
	</div>
</body>
<script defer="after" type="text/javascript">
	$(function() {
		$('#areaId').change(function() {
			var areaId = $(this).val();	
			$('#forumId').empty();
			$.getJSON('/ng/m/topic/load_forums?areaId=' + areaId, function(data) {
				$.each(data, function(i, item) {
					$('<option>').val(item.areaId).text(item.name).appendTo('#forumId');
				})
			})
		});

		$('#type').change(function() {
			var type = $(this).val();

			$('#title').val(type + " " + $('#title').val());
		})
	});
</script>
</html>
 

举报
龙凯
发帖于5年前 1回/1K+阅
顶部