Skip to content

JavaScript with JQuery client

Fanie Reynders edited this page Jan 18, 2016 · 1 revision

Simply reference the proxy endpoint provided inside your HTML and you're good to go:

<script src="/api/proxies" type="text/javascript"></script>

It allows you to use it in JavaScript like this:

$.proxies.person.get()
  .done(function(people) {
    //do something with people
});

$.proxies.person.get(2)          //get person with id = 2
  .done(function(person) {
    //do something with person
});

This functionality was adopted from ProxyApi - kudos to Stephen Greatrex :)