views:

95

answers:

4

If I want to get data to update partially in a page with jquery (or something else) ajax, does the page I call have to be a web service? Or will just any page that returns json or xml be fine?

I guess I'm asking it like this because in asp.net you have "offical" web services. In other languages and frameworks they may not be like that. I know for example that I can create a classic asp page and return an xml document. Is that a web service?

+4  A: 
chaos
+7  A: 

It doesn't even have to return JSON or XML--it can return HTML or text that you can just drop into the calling page.

I've used "all of the above" in one place or another.

mgroves
+4  A: 

The page does not have to be an "official" Web Service. It doesn't even have to return JSON or XML, you just need to be able to work with the results in your client code.

In general, an ASP page (or anything else you can send a request to and get a response from via HTTP) can be a "web service", but not a "Web Service".

Hank Gay
A: 

For simple tasks, you should return html. As simple as that. For use in jquery you return JSON. No web service is needed, but it is possible to make web service return JSON result, that could be used in your page. This would be a practice when you already have a webservice with data that you need for page. Otherwise it is no need to do so.