Event:
Javascript:
In to CS file:
Hope it will help you.
<a class="btnTwo btnTwoOrange btnSelectSend" href="JavaScript:" id="btnSelectSend" onclick="SendEmail();">Gönder</a>
Javascript:
<script type="text/javascript">
function SendEmail() {
var bookId = document.getElementById("BookID").value;
var name = document.getElementById("sendername").value;
var email = document.getElementById("senderEmail").value;
$.ajax({
type: "POST",
url: "Forbes.aspx/SendEmail",
data: "{ bookId: '" + bookId + "',name: '" + name + "',email: '" + email + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: "true",
cache: "false",
success: function (msg) {
// do something
},
Error: function (x, e) {
// On Error
}
});
}
</script>
In to CS file:
[WebMethod]
public static void SendEmail(string bookId, string name, string email)
{
try
{
MemberService.SendForbesEmail(bookId, name, email, db, m_Member);
}
catch (Exception ex)
{
throw;
}
}
Hope it will help you.
Comments
Post a Comment