Home  >  Article  >  Backend Development  >  javascript - jquery gets value, ios and android get value problem

javascript - jquery gets value, ios and android get value problem

WBOY
WBOYOriginal
2016-12-01 01:27:281007browse

jquery can get the value, ios can’t get it, but android can

<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>

}
javascript - jquery gets value, ios and android get value problem

Reply content:

jquery can get the value, ios can’t get it, but android can

<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>

}
javascript - jquery gets value, ios and android get value problem

You comment on other things first, and only run this line when entering the page. I just tested it on iPhone version 7.2, and it works.

<code>var id=$(".main_box ul li:last-child").find('.delete_btn').attr('field');alert(id);</code>

Declare the function in the ready function.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn