Atul
Atul

Reputation: 1590

Calling REST web service from java script

We are calling a REST web service from a jquery. The target url happens to be on different domain.

We have already referred below url to get this working.

Calling Restful Web service using jQuery ajax

But the real issue is , the target REST web service is not returning the response headers required for CROSS CONTEXT working. (as mentioned in the above url) , and REST web service is not in our control . Hence we are getting failure response from REST web service.

Is there any way we can resove this issue and get this cross context thing working ?

Also , we tested the same REST service through REST plugin in Mozilla (add on) , found out that server returns success

Also rest web service uses "Basic authentication" mechanism for web security .

Upvotes: 0

Views: 273

Answers (1)

ram
ram

Reputation: 2343

This can be achieved using AJAX using jsonp in JQuery, yet this may workout only for all GET API calls.

The better approach would be handling REST API url using curl in any PHP file.

This really works for cross-domain urls...

Upvotes: 1

Related Questions