Skip to content

Commit

Permalink
[WebUI IntelliHome#7] Modidied function for post data to the server
Browse files Browse the repository at this point in the history
  • Loading branch information
skullbocks committed Aug 19, 2014
1 parent 2471ae5 commit a7ccb31
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions assets/public/js/functions_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
Expand All @@ -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');
Expand Down

0 comments on commit a7ccb31

Please sign in to comment.