Skip to content
This repository has been archived by the owner on Dec 4, 2019. It is now read-only.

Commit

Permalink
Extract an AJAX helper for the frontend.
Browse files Browse the repository at this point in the history
  • Loading branch information
franzliedke committed Sep 4, 2014
1 parent 123efa5 commit e7d502b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
8 changes: 2 additions & 6 deletions public/js/admin.js
Expand Up @@ -40,12 +40,8 @@ $(document).ready(function() {
$setting.removeClass('saved');

if (old !== value) {
$.ajax({
type: 'POST',
url: '/admin/settings/' + name,
data: {
value: value
}
FluxBB.ajax('POST', 'admin/settings/' + name, {
value: value
}).success(function(data) {
$setting.data('old', value);
$setting.addClass('saved');
Expand Down
11 changes: 11 additions & 0 deletions public/js/fluxbb.js
@@ -0,0 +1,11 @@
var FluxBB = {
ajax: function(method, path, data) {
path = '/' + path;

return $.ajax({
type: method,
url: path,
data: data
});
}
};
1 change: 1 addition & 0 deletions src/views/admin/layout/main.blade.php
Expand Up @@ -44,6 +44,7 @@
<script src="{{ URL::asset('packages/fluxbb/core/js/morris.min.js') }}"></script>
<script src="{{ URL::asset('packages/fluxbb/core/js/bootstrap.min.js') }}"></script>
<script src="{{ URL::asset('packages/fluxbb/core/js/application.js') }}"></script>
<script src="{{ URL::asset('packages/fluxbb/core/js/fluxbb.js') }}"></script>
<script src="{{ URL::asset('packages/fluxbb/core/js/admin.js') }}"></script>

</body>
Expand Down

0 comments on commit e7d502b

Please sign in to comment.