code_junkie

How to Call a method via AJAX without causing the page to render at all?

Nov 10th, 2011
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  2. Response.Cache.SetCacheability(HttpCacheability.NoCache)
  3. If Request.HttpMethod = "GET" Then
  4. 'do some work and return the rendered html
  5. ElseIf Request.HttpMethod = "POST" Then
  6. 'do some work and return xml
  7. Response.ContentType = "text/xml"
  8. Response.Write("<data></data>")
  9. Response.End()
  10. Else
  11. Response.StatusCode = 404
  12. Response.End()
  13. End If
  14. End Sub
Add Comment
Please, Sign In to add comment