James Wilson
James Wilson

Reputation: 5150

ASP.net making an AJAX call with Jquery

I know how to do this with classic asp.

How do I do it with ASP.net?

Can I just make a code page like verifyLogin.cs

And call that page from Jquery?

Or would I have to make a page like verifyLogin.aspx with a code behind page?

Upvotes: -1

Views: 41

Answers (1)

McGarnagle
McGarnagle

Reputation: 102723

There are lots of different ways to do it, depending on your requirements. Here's a very simple way to start though. Create a page called "AjaxData.aspx" with no code-behind:

<%@ Page Language="C#" %>
<%
    Response.ContentType = "text/plain";
    string data = "some data";
    Response.Write(data);
%>

Then use your AJAX call as normal:

$.get("AjaxData.aspx", function(data) {
    alert(data);
});

Upvotes: 1

Related Questions