$(document).ready(function () {
$('#SendMail').click(function () {
debugger;
var str = $("#BodyStr").html();
var result = $.ajax({
type: "POST",
url: "VBAjax_SendMail.aspx/TestAjax",
data: '{ strBody: "' + str + '" }',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: succeeded,
failure: function (msg) {
alert(msg);
},
error: function (xhr, err) {
alert(err);
}
});
});
// //'{ strBody: "1833", qty: "13", lblType: "1" }',
})
function succeeded(msg) {
debugger;
alert(msg.d);
}
-.aspx.vb
Imports System.Web.Services
Public Shared Function TestAjax(strBody As String) As String
Dim selectedProduct As String = String.Format("{0}", strBody)
HttpContext.Current.Session("test") = selectedProduct
Return HttpContext.Current.Session("test").ToString()
End Function