Ajax + Code json在Lessthan IE 9中不起作用 [英] Ajax+ Code json not working in Lessthan IE 9

查看:78
本文介绍了Ajax + Code json在Lessthan IE 9中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







我在msdn中有一个疑问我在.cs页面创建了一个方法。我想使用jquery在aspx中访问此方法。这里是代码的一部分。







功能listint(){

尝试{

$ .ajax({

类型:POST,

//在此处调用代码隐藏方法。

url:Dynamictable.aspx / listint,

//从后面的代码中获取数据。



数据: {},

contentType:application / json; charset = utf-8,

dataType:json,

成功:功能(响应){

//将值拆分为数组并反转为数组。这里

var data = response.d.splice()。reverse() ;



$ .each(数据,功能(索引,项目){

退货;

});

for(var i = 0;我< data.length; i ++){

$('#myTable')。find('#mytr0')。find(#Td1)。after('

'+'整数类型 - '+''+ data [i] +'
');

}

},

失败:function(){alert(failed); }

});

}

catch(e){



}

}



但是我的代码不能用于低于IE-9版本。以上代码在IE 9,Firefox,Chrome上面工作正常。 c









Hi,


I have one doubt in msdn I have created one method in .cs page. I want access this method in aspx using jquery. Here the part of the code.



function listint() {
try {
$.ajax({
type: "POST",
//Calling code behind method here.
url: "Dynamictable.aspx/listint",
// Get the data from code behind.

data: {},
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
//getting the values split into array and reverse into arrays. here
var data = response.d.splice(" ").reverse();

$.each(data, function (index, item) {
return item;
});
for (var i = 0; i < data.length; i++) {
$('#myTable').find('#mytr0').find("#Td1").after('

' + 'Integer Type-' + ' ' + data[i] + '
');
}
},
failure: function () { alert("failed"); }
});
}
catch (e) {

}
}

But my code is not working In Less-than IE-9 Version. the above code is working fine in above IE 9, Firefox, Chrome .c.




<table id="myTable">
       <tr id="mytr0">
           <td id="mytd1">Step-1</td>
           <td id="mytd2">kiran</td>
            <td id="Td1">kiran</td>
       </tr>

       <tr id="mytr1">
           <td>
               Step-2
           </td>
           <td id="mytrtd">
           sandeep </td>
       </tr>
       <tr id="mytr3">

           <td>
               Step-3
              </td>

               <td> Prajwal </td>

               <td>
               Miriyala

               </td>


       </tr>
</table>



..



< br $>




aspx.cs页面中的代码隐藏方法










..




Code behind method in aspx.cs pages




[WebMethod]
    public static List<int> listint()
    {
        var list = new List<int>();
        list.Add(1);
        list.Add(2);
        list.Add(3);
        list.Add(4);
        list.Add(5);
        return list;

    }

推荐答案

.ajax({

type:POST ,

//在这里调用代码隐藏方法。

url:Dynamictable.aspx / listint,

//从代码中获取数据后面。



数据:{},

contentType:application / json; charset = utf-8,

dataType:json,

成功:函数(响应){

//将值拆分为数组并反转为数组。这里

var data = response.d.splice()。reverse();


.ajax({
type: "POST",
//Calling code behind method here.
url: "Dynamictable.aspx/listint",
// Get the data from code behind.

data: {},
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
//getting the values split into array and reverse into arrays. here
var data = response.d.splice(" ").reverse();


.each(数据,功能) (索引,项目){

返回项目;

});

for(var i = 0; i< data.length;我++ ){
.each(data, function (index, item) {
return item;
});
for (var i = 0; i < data.length; i++) {


('#myTable')。find('#mytr0')。find(#Td1)。after(' < tr>
'+'整数类型 - '+''+ data [i] +'
');

}

},

失败:function(){alert( 失败); }

});

}

catch(e){



}

}



但是我的代码不能用于低于IE-9版本。以上代码在IE 9,Firefox,Chrome上面工作正常。 c









('#myTable').find('#mytr0').find("#Td1").after('
' + 'Integer Type-' + ' ' + data[i] + '
');
}
},
failure: function () { alert("failed"); }
});
}
catch (e) {

}
}

But my code is not working In Less-than IE-9 Version. the above code is working fine in above IE 9, Firefox, Chrome .c.




<table id="myTable">
       <tr id="mytr0">
           <td id="mytd1">Step-1</td>
           <td id="mytd2">kiran</td>
            <td id="Td1">kiran</td>
       </tr>

       <tr id="mytr1">
           <td>
               Step-2
           </td>
           <td id="mytrtd">
           sandeep </td>
       </tr>
       <tr id="mytr3">

           <td>
               Step-3
              </td>

               <td> Prajwal </td>

               <td>
               Miriyala

               </td>


       </tr>
</table>



..



< br $>




aspx.cs页面中的代码隐藏方法










..




Code behind method in aspx.cs pages




[WebMethod]
    public static List<int> listint()
    {
        var list = new List<int>();
        list.Add(1);
        list.Add(2);
        list.Add(3);
        list.Add(4);
        list.Add(5);
        return list;

    }


这篇关于Ajax + Code json在Lessthan IE 9中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆