Last active
February 22, 2017 20:55
-
-
Save EricCote/bbed62646259b4b2a07b352887a79864 to your computer and use it in GitHub Desktop.
Mercredi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="jquery-3.1.1.js" /> | |
$(function () { | |
$("#btnEmployes").click(function () { | |
var httpRequest = new XMLHttpRequest(); | |
httpRequest.addEventListener("readystatechange", | |
function () { | |
if (httpRequest.readyState === | |
XMLHttpRequest.DONE) { | |
var table = | |
$('<table class="table table-striped"></table>') | |
var thead = $("<thead><tr><th>Nom</th><th>Poste</th><th>Date embauche</th> <tr></thead>"); | |
var tbody = $("<tbody></tbody>"); | |
$(table).append(thead).append(tbody); | |
var liste = JSON.parse(httpRequest.responseText); | |
$.each(liste, function (i, emp) { | |
var row = $("<tr><td>" + emp.nom + | |
"</td><td>" + emp.poste + | |
"</td><td>" + emp.dateEmbauche + "</td></tr>"); | |
$(tbody).append(row); | |
}); | |
$("#sectionEmploye").append(table); | |
} else { | |
} | |
}); | |
httpRequest.open("GET", "/employes", true); | |
httpRequest.send(null); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
var jsonformatter = | |
GlobalConfiguration.Configuration.Formatters.JsonFormatter; | |
jsonformatter.SerializerSettings.ContractResolver = | |
new CamelCasePropertyNamesContractResolver(); | |
... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment