Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var URL_BASE = "http://localhost:8080/eBarRest/rest/eBar";
- var commandId = -1;
- $(document).ready(function() {
- if ($('#carte').size() != 0) {
- $.ajax({
- url: URL_BASE + "/bieres",
- type: "GET",
- data: {
- mot: ""
- },
- dataType: "json",
- accepts: {"json": "application/json"},
- async: false
- })
- .done(function (response, textStatus, xhr) {
- if (response['bieres'] == null)
- return;
- var html = "";
- for (var i = 0; i < response['bieres'].length; i++) {
- html += "<tr>";
- html += "<td>" + response['bieres'][i]['nom'] + "</td>";
- html += "<td>" + response['bieres'][i]['type'] + "</td>";
- html += "<td>" + response['bieres'][i]['couleur'] + "</td>";
- html += "<td>" + response['bieres'][i]['prix'] + "</td>";
- html += "</tr>";
- };
- $('#carte').append(html);
- // commandId = $(response).children("Commande").children("id").eq(0).text();
- })
- .fail(function (xhr, textStatus, errorThrown) {
- console.log(textStatus);
- console.log(errorThrown);
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement