100分问个jquery 返回值判断问题!function wait(){   $.get("wait.asp?randID="+Math.random(),function(data){
   
if(){           //这里写个判断句,不知道怎么写,谁帮帮忙啊!
        $("tips").html(data);      //如果大于5执行这句
}
else{
setTimeout(wait,1000);//如果小于5执行这句
}
       });

}wait.asp<%dim a
a=int(rnd*10)
if a>5 then
response.Write("大于5!!")
response.End()
else
response.Write("小于5!!")
response.End()
end if
%>
<div id =tips></div>

解决方案 »

  1.   

    if(){           //这里写个判断句,不知道怎么写,谁帮帮忙啊!补充:根据wait返回值进行判断。。啊!!!。
      

  2.   

    wait()发送一个请求到wait.asp,wait.asp定义一个a,随机生成a,如果a>5 在DIV(tips)中显示
    那句话,如果不大于5,就在次调用wait(),也就是说小于5那就话是永远不显示的!我就想知道怎么这个
    功能怎么实现~~~~~~~~~在线等解答啊!!!!!先谢谢了
      

  3.   


    我这个返回值要是一句话,或者wait里有一对和数据库联系的句子怎么判断啊比如这样。。
    wait.asp
    <%
    if rs("b")>rs("c") then
    Conn.execute("update 表 set b=b-5 where 条件")
    response.Write("大于5!!")
    response.End()
    else
    Conn.execute("update 表 set b=b+5 where 条件")
    response.Write("小于5!!")
    response.End()
    end if
    %>
    <div id =tips></div>    
      

  4.   

    你不需要输出一句话吧,如果是只有两种情况只需要输出一个标识就可以了<%
    if rs("b")>rs("c") then
    Conn.execute("update 表 set b=b-5 where 条件")
    response.Write("true")
    response.End()
    else
    Conn.execute("update 表 set b=b+5 where 条件")
    response.Write("小于5!!")
    response.End()
    end if
    %>
    <script>
    function wait(){      $.get("wait.asp?randID="+Math.random(),function(data){
           
            if(data=="true"){           //这里写个判断句,不知道怎么写,谁帮帮忙啊!
            $("tips").html("大于5!!");      //如果大于5执行这句    
            }
            else{
            setTimeout(wait,1000);//如果小于5执行这句
            }
           });    
        
    }<script>
    <div id =tips></div>   
      

  5.   

        <% dim a as Integer 
            a=int(rnd*10)
            response.Write("<input type=hidden id=hid value=" & (a>5) & ">")   
            
         %>
       $.get("info.aspx?randID="+Math.random(),function(data){
            
            var rtn=$(data).find("#hid").val();
            if(rtn)
                $("#tips").innerHTML="大于5!!";
            else
                setTimeout(wait,1000);
           });
      

  6.   

    $.get("info.aspx?randID="+Math.random(),function(data){
            
            var rtn=$(data).find("#hid").val();
            if(rtn=="True")
                $("#tips").text("大于5!!");
            else
                setTimeout(wait,1000);
           });
      

  7.   

    还是有问题啊!!!并没有实现自动判断,我希望如果调用下边的settimeout
    就应该实现自动返回判断,但是没有想希望的那样,如果执行了else,settimeout
    调用的wait()返回来的还执行else后边的,怎么才能自动要大于了执行上边的呢?test.asp
    <script type="text/javascript" src="jquery.pack.js"></script><script>
    function wait(){      $.get("test3.asp?randID="+Math.random(),function(data){
           
            if(data=="yes"){   
    alert("上边")        //这里写个判断句,不知道怎么写,谁帮帮忙啊!
               //如果大于5执行这句    
            }
            else{
    alert("下边") 
            setTimeout(wait,1000);//如果小于5执行这句
            }
           });    
        
    }
    </script>
    <body>
    <input type="button" style="width:50px; height:50px" onclick="wait();"  /> 
    </body>test3.asp
    <%dim a
    a=int(rnd*10)
    if a>5 then
    response.Write("yes")
    response.End()
    else
    response.Write("zzzzz")
    response.End()
    end if
    %>
      

  8.   

    我忘写了randomize。。但是还是有问题。。一会在问吧
      

  9.   

    function wait(){      $.get("test3.asp?randID="+Math.random(),function(data){
           
            if(data=="yes"){   
            alert("上边")        //这里写个判断句,不知道怎么写,谁帮帮忙啊!
               //如果大于5执行这句    
            }
            else{
            alert("下边") 
            setTimeout(wait,1000);//如果小于5执行这句
    return;
            }
           });    
        
    }
      

  10.   


    function wait(){      $.get("wait.asp?randID="+Math.random(),function(data){
           
            if(data=="大于5!!"){           //这里写个判断句,不知道怎么写,谁帮帮忙啊!
            $("tips").html(data);      //如果大于5执行这句    
            }
            else{
            setTimeout(wait,1000);//如果小于5执行这句
            }
           });    
        
    }只是补齐了一个判断,别的代码没有任何改动。
      

  11.   

    我试了半天,传到不带数据库的test3.asp中就没问题!!想这样的!!
    <%dim a
    a=int(rnd*10)
    if a>5 then
    response.Write("yes")
    response.End()
    else
    response.Write("zzzzz")
    response.End()
    end if
    %> 只要在这里加入数据库,完了,返回值老执行这个下边的的,为什么加上数据库这样写就不行了?
    function wait(){      $.get("test3.asp?randID="+Math.random(),function(data){
           
            if(data=="yes"){   
            alert("上边")        //这里写个判断句,不知道怎么写,谁帮帮忙啊!
               //如果大于5执行这句    
            }
            else{
            alert("下边") 
            setTimeout(wait,1000);//如果小于5执行这句
            }
           });    
        
    }