/*防伪查询处理请求 *Create By:Daniel Frank *Create Date:2015-04-20 *Version:1.0.0.3 */ function DoQuery(txtCode) { var userurl="http://ws.vt9999.com/SlWebSrvQuery/userip.ashx?jsoncallback=?"; $.ajax({ type: "GET", url: userurl, dataType: "jsonp", timeout:3000, beforeSend:function(XMLHttpRequest){ $("#btnQuery").attr("disable",true); }, complete: function(XMLHttpRequest, textStatus){ $.unblockUI(); }, success : function(json){ GetFwMSgData(txtCode,json.ipaddr); $("#btnQuery").attr("disable",false); }, error : function(){ $.unblockUI(); $.growlUI('信息提示', '请求数据时发生错误!'); $("#btnQuery").attr("disable",false); } }); } function GetFwMSgData(codedata,ipdata) { if(codedata=="") { alert("请输入防伪码!"); return false; } var clientUrl = "http://ws.vt9999.com/SlWebSrvQuery/FWResult.aspx?jsoncallback=?"; var QueryData= { FwCode: codedata, IpAddr:ipdata,ACCESS_TOKEN:"/8MNq4vuMtnbLPZ5bkqc/A==" }; $.ajax({ type: "GET", url: clientUrl, dataType: "jsonp", data : QueryData, timeout:30000, beforeSend:function(XMLHttpRequest){ $.blockUI({ message: '

查询中,请稍后...

'}); }, complete: function(XMLHttpRequest, textStatus){ $.unblockUI(); }, success : OnSuccess, error : OnError }); } function OnSuccess(json) { $("#data").html("查询结果:" + json.FwResult); } function OnError(XMLHttpRequest, textStatus, errorThrown) { $.unblockUI(); $.growlUI('信息提示', '请求数据时发生错误!'); if (errorThrown || textStatus == "error" || textStatus == "parsererror" || textStatus == "notmodified") { $.growlUI('信息提示', '请求数据时发生错误!'); return; } if (textStatus == "timeout") { $.growlUI('信息提示', '请求数据超时!'); return; } }