简体   繁体   中英

Can every request send by ajax (xmlhttprequest) be called as web service request?

I just started using angularjs with spring mvc as backend. I am using $resource for accessing my backend. I know this is a rest service and $resource is a module built with ajax. My doubts:

1) Is ajax used for consuming web service apis only?
2) Is ajax the only way to call web service function?

1) Is ajax used for consuming web service apis only

No, ajax is just a way of making HTTP/HTTPS requests, they can request anything that accepts such a request, but it is most commonly used for consuming web services/APIs.


2) Is ajax the only way to call web service function

No, again, webservices are usually just exposing an endpoint for data, anything capable of making a HTTP/HTTPS request can call it, for example you can type http://www.mywebservice.com/api/get/1 in your browser and you will make a call to the web service and the data would be displayed in the browser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM