Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function loadPage() {
- $.ajax({
- type: "GET",
- url: "classes/ajax/pagesLoad.php",
- dataType: "html",
- success: function(response) {
- $("#pagesload").html(response);
- }
- });
- }
- $(document).ready(function() {
- loadPage();
- });
- $("#addwebsites").submit(function() {
- event.preventDefault();
- $.ajax({
- url: "classes/ajax/addPage.php",
- type: "POST",
- data: new FormData(this),
- contentType: false,
- cache: false,
- processData: false,
- success: function(response){
- if(!response){
- document.getElementById('name').value = "";
- document.getElementById('url').value = "";
- Swal.fire(
- 'Sikeres mentés.',
- '',
- 'success'
- )
- loadPage();
- } else {
- Swal.fire(
- 'Sikertelen mentés.',
- response,
- 'error'
- )
- }
- }
- });
- });
- function deleteText(id) {
- Swal.fire({
- title: 'Biztos vagy benne?',
- text: "A szöveg törlése végleges és visszavonhatatlan.",
- icon: 'warning',
- showCancelButton: true,
- confirmButtonColor: '#3085d6',
- cancelButtonColor: '#d33',
- confirmButtonText: 'Törlés',
- cancelButtonText: 'Mégsem'
- }).then((result) => {
- if (result.value) {
- $.ajax({
- url: "classes/ajax/deleteText.php",
- type: "POST",
- data: {
- 'id': id
- },
- success: function(response) {
- $('#' + id).fadeOut();
- }
- });
- Swal.fire(
- 'Törölve',
- '',
- 'success'
- )
- }
- })
- }
- function deleteWebsite(id) {
- Swal.fire({
- title: 'Biztos vagy benne?',
- text: "A weboldal törlése végleges és visszavonhatatlan.",
- icon: 'warning',
- showCancelButton: true,
- confirmButtonColor: '#3085d6',
- cancelButtonColor: '#d33',
- confirmButtonText: 'Törlés',
- cancelButtonText: 'Mégsem'
- }).then((result) => {
- if (result.value) {
- $.ajax({
- url: "classes/ajax/deleteWebsite.php",
- type: "POST",
- data: {
- 'id': id
- },
- success: function(response) {
- loadPage();
- }
- });
- Swal.fire(
- 'Törölve',
- '',
- 'success'
- )
- }
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement