0

I have some javascript files and an html file. The do some stuff, and I'd like to make an ajax call (using jQuery's $.post() method) to a server to get some info, and then do some more stuff. Do I need to set up some sort of scaffolding before I can do this? I have a .cs file now, can I just run that with VC# and have it respond to the requests? I'm not sure where to begin. I've looked a little for tutorials... but the ones on microsoft.com are old; Thanks!

23890123890

Update: I believe this is ASP.NET MVC

Brett
  • 4,051
  • 2
  • 26
  • 39
23890123890
  • 147
  • 1
  • 1
  • 6

2 Answers2

0

If you're using webforms, you can look at Page Methods

I'm guessing you might be using MVC though, which you may want to refer to this question: PageMethods with ASP.Net MVC

Community
  • 1
  • 1
Brett
  • 4,051
  • 2
  • 26
  • 39
  • I just finished this tutorial: http://www.asp.net/mvc/tutorials/creating-a-mvc-3-application-with-razor-and-unobtrusive-javascript but still don't know what any of it means. It just told me to click a bunch of things. How can I add a controller method that will accept and respond to ajax calls? I'll be wading through the ms docs in the mean time – 23890123890 Jun 01 '11 at 19:26
  • Take a look at this post: http://stackoverflow.com/questions/227624/asp-net-mvc-controller-actions-that-return-json-or-partial-html that should help you build a controller that returns you something besides a `View` – Brett Jun 01 '11 at 19:42
0

Another option if you're not using MVC would be to use WCF to create a service which can receive the jQuery ajax requests. The project at http://wcf.codeplex.com/ has some support for jQuery $.ajax calls.

carlosfigueira
  • 85,035
  • 14
  • 131
  • 171