-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Adam Crampton
committed
Mar 3, 2015
1 parent
eb25927
commit 28d2052
Showing
5 changed files
with
75 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
class AjaxController extends BaseController | ||
{ | ||
public function __construct() | ||
{ | ||
$this->beforeFilter('staff'); | ||
} | ||
|
||
public function ajax_add_comment() | ||
{ | ||
return json_encode(['value' => 'test']); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// General Scripts | ||
$(document).ready(function() | ||
{ | ||
$('#submit_comment').on('click', function() { | ||
add_comment(); | ||
}); | ||
|
||
}); | ||
|
||
// AJAX Functions | ||
function add_comment(event) | ||
{ | ||
$.ajax({ | ||
url: '/ajax/ajax_add_comment', | ||
cache: false, | ||
type: 'POST', | ||
dataType: 'json', | ||
|
||
success: function(response) | ||
{ | ||
console.log(response); | ||
}, | ||
error: function(jqXHR, textStatus, errorThrown) | ||
{ | ||
// Handle errors here | ||
console.log('ERRORS: ' + errorThrown); | ||
} | ||
|
||
}); | ||
|
||
} |