Skip to content Skip to sidebar Skip to footer

How To Transform From Curl Command To Ajax Request

I have command to curl to server to get information curl -v -H 'Content-Type:application/json' -H 'X-KGP-AUTH-TOKEN: a5a95c30274611e2ae10000c29bb7331' -H 'X-KGP-APPID:id.kenhgiaip

Solution 1:

This is a browser issue.

Change dataType to jsonp or add callback=? to your url:

http://test.kenhgiaiphap.vn/kprice/account/profile/get/token?callback=?

Future refer to https://stackoverflow.com/a/6396653/744255

Solution 2:

You cannot use post in client site "Same Origin Policy issue".

Ou can use jsonp instead 'json' and change to get, pretty much following "Gabriel Santos" suggestion

Post a Comment for "How To Transform From Curl Command To Ajax Request"