我页面后台程序还没处理完,我就Response.Flush();提前返回一部数据,用ajax技术咋获得呢?他的回调函数咋写?

解决方案 »

  1.   

    $.ajax({
       type: "POST",
       url: "some.php",
       data: "name=John&location=Boston",
       success: function(msg){
         alert( "Data Saved: " + msg );
       }
    });
      

  2.   

    资料 http://space.itpub.net/12639172/viewspace-481999
      

  3.   

    $.post("路径", { 参数1: 参数值1, 参数2: 参数值2...}, function (result) {
                        //这里写操作
                    })
      

  4.   

    jquery还没学的咋说只会看,不会写
      

  5.   

    jquery不知道,但js写不是要判断(xmlHttp.readyState == 4)嘛。。那他都全部发挥完了啊,我要的是还没发完,只是先发部分回来!
      

  6.   

    jquery比较容易,会一些常用的就够用了,你可以看看一些视频资料。
      

  7.   

    这是前台代码,请问你的方法是在本页面后台的还是WebService中的?
      

  8.   

    考虑 jsonp动态输出语句函数xxx('返回内容');
    .......
    函数xxx('返回内容');
    函数xxx('返回内容');
    函数xxx('返回内容');
      

  9.   

    Response.Write("s");
    Response.End();前台ajax的success的function(msg)
    alert(msg)就可以弹出s
      

  10.   

    他有个参数是返回的对象, 在客户端 转一下就行,  用 ajax 没必要查询一些数据,
      

  11.   

    看我上面说的我用的是flush还没输出完,还有要输出的,咋能end呢????
      

  12.   

    那你最好用带有status的回调函数或者自己实现
    因为默认情况下,只有当xmlhttprequest数据获取并解析完毕时才会执行
    自己写一个也挺简单的function ajaxLoad(url, onsuccss, onerror) {
        if (window.ActiveXObject) { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } }
        else if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest();}
        if (xmlhttp == null) { alert("浏览器不支持XMLHttpRequest,无法动态加载内容!"); return true; }
        xmlhttp.open("GET", url, true);
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4) if (xmlhttp.status == 200) onsuccss(xmlhttp.responseText); else onerror(); 
        }
        xmlhttp.send();    
        return false;   //屏蔽url的点击
    }
    要在解析完毕之前就处理数据,可试着修改上面的为3(正在交互,但未完成解析)