Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function NowaNotyfikacja() {
- if($('#notyfikacjaTytul').val() != '' && $('#notyfikacjaTresc').val() != '' && $('#notyfikacjaUzytkownicy').val() != '') {
- var UserzyListaSelect = document.getElementById('notyfikacjaUzytkownicy');
- var DlaKogoNotyfikacja = UserzyListaSelect.options[UserzyListaSelect.selectedIndex].value;
- const NowaNotyfikacja = {
- notyfikacjaTytul: $('#notyfikacjaTytul').val(),
- notyfikacjaTresc: $('#notyfikacjaTresc').val(),
- notyfikacjaDlaKogo: DlaKogoNotyfikacja
- };
- const jsonString = JSON.stringify(NowaNotyfikacja);
- const xhr = new XMLHttpRequest();
- xhr.open("POST", "../../php-scripts/dodaj-notyfikacje.php");
- xhr.setRequestHeader("Content-Type", "application/json");
- xhr.send(jsonString);
- $('#notyfikacjaTytul').trigger("reset");
- $('#toast-tytul').html('Sukces');
- $('#toast-message').html('Wykonano operację');
- $('.toast').toast('show');
- }
- else
- {
- alert("Wypełnij formularz");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement