+ 3

API: Curl or Cross Ajax Request

Hey guys! At the moment I am working on a big web project and I have to build an API. Normally I use Curl request to get data from an API but I just found out that other sites often use direct cross ajax request to the API domain. Do you know the advantages and disadvantages of each possibility? Would be very interesting!:)

19th Feb 2018, 9:42 PM
saschacode
1 ответ
+ 3
Cross domain AJAX request are stopped by browsers due to security issues so you have to Allow cross AJAX request from your API if your api is consumed by other website with jQuery. You can also use jsonp for making cross domain request, What is JSONP and how to use it in jQuery & JavaScript - http://www.yogihosting.com/jquery-jsonp-example/
25th Feb 2018, 11:37 AM
Lana
Lana - avatar