日期:2014-05-17  浏览次数:20421 次

关于ajax 获取快递信息 倒序问题 求解决
 这是我写的简单js 




//这个链接
//http://www.kuaidi100.com/query?type=yuantong&postid=3480388208&id=1&valicode=&temp=0.5953216721987898 
//处理返回的参数是...

{"message":"ok","nu":"3480388208","ischeck":"1","com":"yuantong","updatetime":"2014-01-20 17:11:39","status":"200","condition":"F00","data":[{"time":"2014-01-14 19:53:00","context":"江西省南昌市市府分部公司 已签收 操作员:胡丹","ftime":"2014-01-14 19:53:00"},{"time":"2014-01-14 12:51:24","context":"江西省南昌市市府分部公司 派件中 操作员:魏斯林","ftime":"2014-01-14 12:51:24"},{"time":"2014-01-13 18:28:37","context":"江西省南昌市市府分部公司 派件中 操作员:魏斯林.","ftime":"2014-01-13 18:28:37"},{"time":"2014-01-13 15:46:36","context":"江西省南昌市市府分部公司 已收入 操作员:魏斯林","ftime":"2014-01-13 15:46:36"},{"time":"2014-01-13 12:18:40","context":"江西省南昌市公司 已发出 操作员:胡相国","ftime":"2014-01-13 12:18:40"},{"time":"2014-01-13 11:48:11","context":"江西省南昌市公司 已拆包 操作员:胡相国","ftime":"2014-01-13 11:48:11"},{"time":"2014-01-13 11:26:05","context":"江西省南昌市公司 已收入 操作员:胡相国","ftime":"2014-01-13 11:26:05"},{"time":"2014-01-13 09:47:05","context":"南昌转运中心公司 已发出 操作员:辜继亮","ftime":"2014-01-13 09:47:05"},{"time":"2014-01-13 09:42:36","context":"南昌转运中心公司 已收入 操作员:辜继承","ftime":"2014-01-13 09:42:36"},{"time":"2014-01-13 09:34:02","context":"南昌转运中心公司 已发出 操作员:徐国花","ftime":"2014-01-13 09:34:02"},{"time":"2014-01-13 09:31:57","context":"南昌转运中心公司 已收入 操作员:吴海友","ftime":"2014-01-13 09:31:57"},{"time":"2014-01-12 16:57:08","context":"浙江省金华市义乌市公司 已收件 操作员:曾永强","ftime":"2014-01-12 16:57:08"},{"time":"2014-01-12 16:47:58","context":"浙江省金华市义乌市公司 已打包 操作员:薛占园","ftime":"2014-01-12 16:47:58"},{"time":"2014-01-12 09:54:07","context":"广州转运中心公司 已发出 操作员:曾剑光","ftime":"2014-01-12 09:54:07"},{"time":"2014-01-12 09:53:03","context":"广州转运中心公司 已收入 操作员:喻水英","ftime":"2014-01-12 09:53:03"},{"time":"2014-01-12 05:53:48","context":"广东省广州市白云区石井公司 已发出 操作员:何俭英","ftime":"2014-01-12 05:53:48"}],"state":"3"}

getJSON 处理

function getWuliu()
{
var showhtml="";
 var wuliuCode=$("#wuliCode").val();
 var wuliuNo=$("#wuliuNo").val();
//因为js 不能跨域  所以建一个处理程序 处理访问快递100的链接
//快递原始链接
//模拟链接http://www.kuaidi100.com/query?type=yuantong&postid=3480388208&id=1&valicode=&temp=0.5953216721987898  这个链接是在处理程序(Ashx_wuliu.ashx)中处理的

 var url="/ashx/Ashx_wuliu.ashx?type="+wuliuCode+"&postid="+wuliuNo+"&temp=" + Math.random();
 alert (url)
    $.getJSON(url, function(ret){  
        if(ret!=null)
        {
            if(ret.message=="ok")
            {
              if(ret.data.length>0){
                 for(var i = 0; i < ret.data.length; i++){
                    
                    showhtml+=ret.data[i].time+" "+ret.data[i].context+"</br>";
                &nb