<div class="grid--cell fl1 lh-lg">
<div class="grid--cell fl1 lh-lg">
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, <a href="/help/reopen-questions">visit the help center</a> for guidance.
</div>
</div>
</div>
<div class="grid--cell mb0 mt8">Closed <span title="2011-07-19 11:58:09Z" class="relativetime">8 years ago</span>.</div>
</div>
</aside>
With a REST API I can receive a response in XML or in JSON. This can be done using PHP or Javascript (using jQuery) for example.
I want to know the advantages and the disadvantages of the different languages. This is what I figured out so far:
</div>
Disregarding any other server side language, when you create your own REST API, the most common way is using PHP for backend and JavaScript for the client side. But there is also the possibility to write JavaScript at the backend (Learning Server-Side JavaScript with Node.js).
Javascripts run on the client side and does not make a load on the server when fetching data with external URLs.
Thats only half the truth, if I understood your question right. If you need data from an external source, JavaScript will be prevented from doing so due to the same origin policy. But there are many possibilities to load data from some other origin like ajax proxy (using your backend as bridge) or JSONP.
The Javascript call will not place a load on your server if the REST API is on an external domain (i.e. not yours). jQuery's ajax() call offers a work-around to allow you to GET data from external domains.
Use PHP if:
Use Javascript when: