Click here to Skip to main content
15,913,685 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.




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

..




Code behind method in aspx.cs pages




XML
[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;

    }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900