site-accueil-insa/assets/js/updateManager.js
2019-07-26 18:44:30 +02:00

26 lines
783 B
JavaScript

$(document).ready(function () {
$(".save").click(function () {
sendLogin($('#usernameInput').val(), $('#passwordInput').val());
});
});
function sendLogin(login, password) {
let object = {
"function": 'update_website',
"login": login,
"password": password,
};
console.log(JSON.stringify(object));
// Do not put .php in the url, otherwise the POST request will transformed in GET when server rewrites the url
$.ajax({
type: "POST",
url: "../ajax/write/master",
data: JSON.stringify(object),
dataType: "json",
contentType: "application/json; charset=utf-8",
complete: function (data) {
alert(data.responseText);
console.log(data);
},
});
}