how to pass value in varaiable to jquery from handlers
Imports System.Web
Imports System.Web.Services
Imports System.Data.SqlClient
Imports System.Net.Mail
Public Class NewsLetter_Handler
Implements System.Web.IHttpHandler
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
context.Response.AddHeader("Pragma", "no-cache")
context.Response.AddHeader("Cache-Control", "private, no-cache")
Debug.WriteLine("Process")
NewsletterSubmit(context)
End Sub
ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
' Handle request based on method
Private Sub HandleMethod(ByVal context As HttpContext)
Select Case context.Request.HttpMethod
Case "HEAD", "GET"
Exit Select
Case "POST", "PUT"
NewsletterSubmit(context)
Debug.WriteLine("post")
Exit Select
Case "DELETE"
Exit Select
Case "OPTIONS"
Exit Select
Case Else
context.Response.ClearHeaders()
context.Response.StatusCode = 405
Exit Select
End Select
End Sub
Public Sub NewsletterSubmit(ByVal context As HttpContext)
Debug.WriteLine("submit")
Dim Name1 As String = context.Request.Params("Name")
Dim email1 As String = context.Request.Params("Email")
Dim HomePageUrl As String = "default.aspx"
Dim validationCode As Integer = New Random().[Next]()
Dim returnValue As Integer = Newsletter_DatabaseHelper.AddNewSubscriber(Name1, email1, validationCode)
If returnValue = 1 Then
Try
Newsletter_Util.SendValidationEmail(email1, validationCode)
'message.Text = "Thank you for making a point by subscribing. An confirmation email has been sent to you. To validate your subscription, please click on the given link. "
Catch ex As Exception
'message.Text = "Your email address has been added to our database but the validation email to confirm your address could not be sent at this time. Please <a target='_blank' href=""" & "ValidateEmail.aspx?email=" & Server.UrlEncode(email_1) & " "">click here</a> to resend the validation email."
End Try
ElseIf returnValue = 0 Then
message.Text = "Your validated email address is already in our database. <br/>There is no need to subscribe again."
ElseIf returnValue = -1 Then
message.Text = "Your email address is already in our database but it has not yet been validated. If you would like to receive the validation link again then <a target='_blank' href=""ValidateEmail" & ".aspx?email=" & Server.UrlEncode(email_1) & """>click here</a>."
End If
End Sub
End Class
i want to pass this message text to jquery n display to particular variable
Smadhu
Member
510 Points
985 Posts
how to pass value in varaiable to jquery from handlers
Apr 22, 2012 12:45 PM|LINK
how to pass value in varaiable to jquery from handlers
Imports System.Web Imports System.Web.Services Imports System.Data.SqlClient Imports System.Net.Mail Public Class NewsLetter_Handler Implements System.Web.IHttpHandler Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest context.Response.AddHeader("Pragma", "no-cache") context.Response.AddHeader("Cache-Control", "private, no-cache") Debug.WriteLine("Process") NewsletterSubmit(context) End Sub ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable Get Return False End Get End Property ' Handle request based on method Private Sub HandleMethod(ByVal context As HttpContext) Select Case context.Request.HttpMethod Case "HEAD", "GET" Exit Select Case "POST", "PUT" NewsletterSubmit(context) Debug.WriteLine("post") Exit Select Case "DELETE" Exit Select Case "OPTIONS" Exit Select Case Else context.Response.ClearHeaders() context.Response.StatusCode = 405 Exit Select End Select End Sub Public Sub NewsletterSubmit(ByVal context As HttpContext) Debug.WriteLine("submit") Dim Name1 As String = context.Request.Params("Name") Dim email1 As String = context.Request.Params("Email") Dim HomePageUrl As String = "default.aspx" Dim validationCode As Integer = New Random().[Next]() Dim returnValue As Integer = Newsletter_DatabaseHelper.AddNewSubscriber(Name1, email1, validationCode) If returnValue = 1 Then Try Newsletter_Util.SendValidationEmail(email1, validationCode) 'message.Text = "Thank you for making a point by subscribing. An confirmation email has been sent to you. To validate your subscription, please click on the given link. " Catch ex As Exception 'message.Text = "Your email address has been added to our database but the validation email to confirm your address could not be sent at this time. Please <a target='_blank' href=""" & "ValidateEmail.aspx?email=" & Server.UrlEncode(email_1) & " "">click here</a> to resend the validation email." End Try ElseIf returnValue = 0 Then message.Text = "Your validated email address is already in our database. <br/>There is no need to subscribe again." ElseIf returnValue = -1 Then message.Text = "Your email address is already in our database but it has not yet been validated. If you would like to receive the validation link again then <a target='_blank' href=""ValidateEmail" & ".aspx?email=" & Server.UrlEncode(email_1) & """>click here</a>." End If End Sub End Class