From a7ccb31a2d711c7db2d1382ceb1d32eeb4cc9a3f Mon Sep 17 00:00:00 2001 From: skullbocks Date: Tue, 19 Aug 2014 12:27:20 +0200 Subject: [PATCH] [WebUI #7] Modidied function for post data to the server --- assets/public/js/functions_script.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/assets/public/js/functions_script.js b/assets/public/js/functions_script.js index 42d0f31..596835d 100644 --- a/assets/public/js/functions_script.js +++ b/assets/public/js/functions_script.js @@ -14,8 +14,8 @@ window.location.href = $(this).attr("data-post"); }); $body.on('click', '.delete-row', function() { - alert("/delete-" + $(this).attr("data-type") + "/" + $(this).parent().parent().attr("id")); - $.post("/delete-" + $(this).attr("data-type") + "/" + $(this).parent().parent().attr("id"), function(data) { + alert("/delete_" + $(this).attr("data-type") + "/" + $(this).parent().parent().attr("id")); + $.post("/admin/delete_" + $(this).attr("data-type") + "/" + $(this).parent().parent().attr("id"), function(data) { $(this).parent().parent().remove(); }, "json"); }); @@ -36,9 +36,10 @@ $thisButton.attr('disabled', 'disabled'); $thisButton.children('span').text(" Loading..."); $thisButton.children('i').addClass('fa fa-spinner fa-spin'); - alert($thisButton.parent().parent(".form-data-body").find('form').serialize()); var $thisForm = $thisButton.parent().parent(".form-data-body").find('form'); - $.post($thisButton.attr('data-action') + '/', $thisForm.serialize(), function(data) { + var formData = JSON.stringify($thisForm.serializeArray()); + console.log(formData); + $.post("/admin/"+$thisButton.attr('data-action') + '/', {data: formData}, function(data) { $thisButton.removeAttr('disabled'); $thisButton.children('span').text(buttonText); $thisButton.children('i').removeClass('fa fa-spinner fa-spin');