Tuesday, October 22, 2013

Jquery Ajax Call With & Without Json



Jquery Ajax Call

var str = $('#loginform').serialize();
$.ajax({
type: 'POST',
url: "../Sessions/AttemptSenderLogin?txtEmail=" + $("#txtEmail").val() + "&txtPassword=" + $("#txtPassword").val(),
data: str,
success: function(data) {
},
error: function(res) {
}
});

Jquery Ajax Call  With JsonType

$.ajax({
type: "GET",
url: "/AdminTransactions/GetThreatMetrixDeviceIdDetails",
data: "deviceId=" + $('#HdnDeviceId').val() + "&transId=" + $('#HdnTransaciontId').val(),
dataType: 'json',
error: function () {
},
success: function (data) {
if (data != '') {
$.each(data, function (index, item) {
//item.ProcessingFee // Get Json Values
});
}
}
});

No comments:

Post a Comment