jQuery Mobile应用之火车票查询
效果图:

在CMD中输入如下代码
corsproxy
(前提是有node.js环境,并先安装corsproxy)
html:
<!DOCTYPE html>
<html> <head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title></title>
<link rel="stylesheet" href="css/jquery.mobile-1.4.5.min.css" />
<script type="text/javascript" src="js/jquery-2.1.0.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.4.5.min.js"></script>
</head> <body> <div data-role="page" id="pageone">
<div data-role="header" data-position="fixed">
<h1>火车时刻表查询</h1>
</div>
<div data-role="fieldcontain">
<label for="name">
发车站
</label>
<input type="text" name="name" id="start" value="长沙" />
</div> <div data-role="fieldcontain">
<label for="name">
终点站
</label>
<input type="text" name="name" id="end" value="北京" />
</div> <div data-role="fieldcontain">
<label for="name">
车次
</label>
<input type="text" name="name" id="name" value="" />
</div>
<a href="#" id="search" data-role="button" data-transition="pop">查询</a> <ul id="result" data-role="listview" data-split-icon="gear"></ul> <div data-role="footer" data-position="fixed"> <div data-role="navbar"> <ul> <li>
<a href="#link" data-role="button" data-icon="search" data-iconpos="top">查询</a>
</li> <li>
<a href="#link" data-role="button" data-icon="user" data-iconpos="top">我的</a>
</li>
<li>
<a href="#link" data-role="button" data-icon="video" data-iconpos="top">设置</a> </li>
</ul>
</div>
</div>
</div> <script>
$(document).on("tap", "#search", function() {
var start = $("#start").val();
var end = $("#end").val();
var url = "http://localhost:1337/api.jisuapi.com/train/station2s?";
var data = {
appkey: "c282f9956c5a3210",
start: start,
end: end
};
$.getJSON(url, data, function(j) {
console.log(j.result);
$(j.result).each(function() {
// console.log(":"+this.costtime);
var arrivaltime = this.arrivaltime;
var costtime = this.costtime;
var departuretime = this.departuretime;
var endstation = this.endstation;
var station = this.station;
var trainno = this.trainno;
$("#result").
append("<li id=\"to\"><h3><a>" + trainno + "</a></h3><p><strong>" + station + "--" + endstation + "</strong></p><p>用时:" + costtime + "</p><p class=\"ui-li-aside\"><strong>" + departuretime + "--" + arrivaltime + "</strong></p></li>").listview('refresh');
}) });
})
</script> <script>
$(document).on("click", "#to", function() {
$.mobile.changePage("#pagetwo", 'pop');
});
</script> <!--
作者:1984982452@qq.com
时间:2016-07-11
描述:第二页
--> <div id="pagetwo" data-role="page" data-position="fixed">
<div data-role="header" data-position="fixed">
<a data-rel="back" data-transition="slide" data-role="button" data-icon="back" data-iconpos="notext">Search</a>
<h1>XX车次</h1>
</div>
<div class="ui-grid-b">
<div class="ui-block-a"><strong>站点</strong></div>
<div class="ui-block-b"><strong>到点</strong></div>
<div class="ui-block-c"><strong>开点</strong></div>
</div>
<div class="ui-grid-b">
<div class="ui-block-a">北京南</div>
<div class="ui-block-b">----</div>
<div class="ui-block-c">08:00</div>
</div>
</div>+ </body> </html>
jQuery Mobile应用之火车票查询的更多相关文章
- jQuery Mobile入门
转:http://www.cnblogs.com/linjiqin/archive/2011/07/17/2108896.html 简介:jQuery Mobile框架可以轻松的帮助我们实现非常好看的 ...
- jquery.mobile手机网页简要
先上最终效果: 最近做了一个用手机浏览器访问的web应用,采用较流行的HTML5,为了提高开发效率节省时间决定采用现有开源框架,免去了自己做设计与兼容性. 一些比较优秀的框架:10大优秀的移动Web应 ...
- jquery mobile页面跳转缓存问题解决
最近,我的一个写后端的同事因为缺前端自己做起了前端的活儿,因为对前端的不熟悉,找寻了一些现成框架想轻松了事,做一个web app他选了jquery mobile,开发效率确实高,但是这个框架的一些坑也 ...
- Jquery mobile 新手问题总汇
1页面缩放显示问题 问题描述: 页面似乎被缩小了,屏幕太宽了. 解决办法: 在head标签内加入: <meta name="viewport" content="w ...
- [转载]Jquery mobile 新手问题总汇
原文链接:http://www.wglong.com/main/artical!details?id=4 此文章将会持续更新,主要收录一些新手比较常见的问题. 欢迎 向我推荐比较典型的常见问题,我会记 ...
- 经典收藏 50个jQuery Mobile开发技巧集萃
http://www.cnblogs.com/chu888chu888/archive/2011/11/10/2244181.html 1.Backbone移动实例 这是在Safari中运行的一款Ba ...
- jquery mobile 教程
简介:jQuery Mobile框架可以轻松的帮助我们实现非常好看的.可跨设备的Web应用程序.我们将后续的介绍中向大家介绍大量的代码及实例. jQuery一直以来都是非常流行的富客户端及Web应用程 ...
- jQuery Mobile高手必备的十大技巧和代码片段
与任何新技术一样,常常难就难在如何开始入手. 有鉴于此,我们整理出了与jQuery Mobile库有关的我认为最便利的一些技巧.方法和代码片段. 由于本文不是旨在全面介绍使用jQuery Mobile ...
- jquery mobile 学习总结
<!doctype html><html lang="zh-CN"><head> <meta charset="UTF-8&qu ...
随机推荐
- tjkd-html
<div class="result-item"> <div class="kd-item"> <div class=" ...
- git review出现的问题
在提交代码review的时候可能会出现 Could not connect to gerrit.Enter your gerrit username: xxxxTrying again with ss ...
- nginx tomcat 动静分离
所谓动静分离就是通过nginx(或apache等)来处理用户端请求的图片.html等静态的文件,tomcat(或weblogic)处理jsp.do等动态文件</span>,从而达到动静页面 ...
- js的forEach,for in , for of
forEach遍历数组 [].forEach(function(value, index, array) { // ... }); 例子 var myArry =[1,2,3,4]; myArry.d ...
- iOS上线...踩坑
总结一下上线过程中出现的问题: 1.AppStore不允许app中出现下载别的app的提示 (例如:三方登录的时候,检测到手机未安装QQ,微信,微博,提示你的设备未安装!❌❌❌ 正确的做法:未安装的, ...
- HTML5web存储之localStorage
localStorage与cookie的作用类似,只能存储字符串,以键值对的方式进行存储:与cookie不同的是,可以存储更多的数据. localStorage用于持久化的本地存储. var skey ...
- iptables的conntrack表满了导致访问网站很慢
iptables的conntrack表满了导致访问网站很慢 转载自:https://my.oschina.net/jean/blog/189935 检查系统conntrack表是否满 现象:突然发现访 ...
- Java提高篇——对象克隆(复制)
假如说你想复制一个简单变量.很简单: int apples = 5; int pears = apples; 不仅仅是int类型,其它七种原始数据类型(boolean,char,byte,short, ...
- 关于sql优化的一个小总结
1.数据量大的时候,可以分多次查询2.有些数据的存储可以分主次表,此表存一些不常用的数据3.union all 比union效率要高4.尽量不要用distinct5.不返回不需要的行和列6.根据条件加 ...
- 移动应用开发过程中需要哪些IOS APP工具
虽说如今要开发一款IOS app应用软件已经不是什么难事,app开发技术已经发展成熟,所以要制作一款适用于苹果IOS智能操作系统的app软件也挺容易的了.不过对于开发者来说,可以通过一些app工具来更 ...