Maison >développement back-end >tutoriel php >javascript - jquery获取值,ios和android获取值问题
jquery获取值,ios获取不到,而android可以
<code><script type="text/javascript"> var pageurl="{:U('App/Friends/page')}"; var tpl="{$tpl}App/Friends/Public/"; var headimgurl="{$person['headimgurl']}"; var openid="{$person['openid']}"; var uname="{$person['uname']}"; var classid="{$person['classid']}"; var isadmin="{$person['isadmin']}"; var isblack="{$person['isblack']}"; var arr=[0,10,20,30,60]; var contenturl="{:U('App/Friends/getcontent')}"; $(document).ready(function(){ $('.loading_box').attr('style','display:none'); ajaxform(); setInterval("ajaxform()",3000); }); </script> function ajaxform(){ var id=$(".main_box ul li:last-child").find('.delete_btn').attr('field');alert(id);alert(isadmin); $.ajax({ type:'POST', url:"{:U('App/Friends/ajaxform')}", data:{"openid":openid,"id":id}, dataType:"json", global:false, success:function(data){ $.each(data[1],function(e,a){ isblack=a; }); } });</code>
}
jquery获取值,ios获取不到,而android可以
<code><script type="text/javascript"> var pageurl="{:U('App/Friends/page')}"; var tpl="{$tpl}App/Friends/Public/"; var headimgurl="{$person['headimgurl']}"; var openid="{$person['openid']}"; var uname="{$person['uname']}"; var classid="{$person['classid']}"; var isadmin="{$person['isadmin']}"; var isblack="{$person['isblack']}"; var arr=[0,10,20,30,60]; var contenturl="{:U('App/Friends/getcontent')}"; $(document).ready(function(){ $('.loading_box').attr('style','display:none'); ajaxform(); setInterval("ajaxform()",3000); }); </script> function ajaxform(){ var id=$(".main_box ul li:last-child").find('.delete_btn').attr('field');alert(id);alert(isadmin); $.ajax({ type:'POST', url:"{:U('App/Friends/ajaxform')}", data:{"openid":openid,"id":id}, dataType:"json", global:false, success:function(data){ $.each(data[1],function(e,a){ isblack=a; }); } });</code>
}
你先注释其它的,页面进入只运行这行,我刚用7.2版本iphone的测试,可以出来的。
<code>var id=$(".main_box ul li:last-child").find('.delete_btn').attr('field');alert(id);</code>
声明function放在ready函数里。