jQuery Ajax实例参考

    //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 () {//请求失败处理方法
                    }
                });

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。