Javascript callback functions with ajax
$('#btnClick0').click(function () {
JSonObject2(function (fval) {
alert(fval.d);
});
});
function JSonObject2(fval) {
$.ajax({
type: 'POST',
url: 'JSonObject2.aspx/Demo',
data: JSON.stringify({ a: 'value' }),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: fval,
error: function (err) {
alert(error);
},
async: true
});
}