I don't know what's wrong with this code. I am not able to implement it properly. Thanks in advance for help. This is what I've tried so far and stuck
<script type="text/javascript">
$(document).ready(function () {
for (var key in localStorage) {
GetQuickVL(key);
}
});
function GetQuickVL(key) {
if (key.substring(0, 4) == "vhs-") {
$.ajax({
type: "POST",
url: "/QuickViewList.aspx/GetQuickVD",
data: '{key: ' +'1' + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert(response.response);
},
error: function (response) {
alert(response.error);
}
});
}
}
function OnSuccess(response) {
alert('df');
}
</script>
and the C-Sharp code is
[WebMethod]
public int GetQuickVD(int key)
{
return key;
}