码迷,mamicode.com
首页 > Web开发 > 详细

jQuery Ajax实例参考

时间:2015-05-03 23:40:24      阅读:310      评论:0      收藏:0      [点我收藏+]

标签:

    //ajax请求数据

    var sendData = {
                    "action": "flightstop",
                    "flightno": _dataArray[0],
                    "s": _dataArray[1],
                    "e": _dataArray[2],
                    "sd": _dataArray[3],
                    "r": Math.random()
                };
               //设置30秒超时
                var timeoutvalue = 30 * 1000;
                $.ajax({
                    type: "get", //请求方式
                    dataType: "json",//请求数据类型
                    url: "SearchHandler",
                    data: sendData,//请求数据
                    timeout: timeoutvalue,//请求超时时间
                    success: function (data, status) {//请求成功处理方法
                        if (data.code == "0000") {
                            $("#" + _span_id).html("<font color=‘#0069ca‘>经停:" + data.airport + "(" + data.arrivetime + "到达," + data.leavetime + "起飞)</font>");
                        }
                        else {
                            $("#" + _span_id).html("经停");
                        }
                    },
                    error: function () {//请求失败处理方法
                    }
                });

jQuery Ajax实例参考

标签:

原文地址:http://www.cnblogs.com/jinpn/p/4474998.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!