ebb
ebb

Reputation: 9377

Interact with API - How?

Updated the question in order to make it more clear:

I'm interacting with an API in order to do some CRUD operations.

Now should I call the API directly in my JQuery/Javascript code, and wrap the POST requests into actions server side? Or should I simply throw both GET and POST requests to the API into the server side, and then call the actions at server side?

Upvotes: 1

Views: 493

Answers (1)

jdc0589
jdc0589

Reputation: 7018

Your question is a little unclear, but it sounds like you are running in to a cross-site-scripting issue. You can not issue ANY ajax request via javascript to a domain other than the one the current page came from. jQuery supports every HTTP method including post, but if you try to issue a request to a different domain, the browser will disallow the request. There are workarounds for this, such as JSONP.

Please clarify your original question if this is not the issue.

Upvotes: 1

Related Questions