Fixes a 500 @ api/dimiss

main
Paul Schneider 9 years ago
parent aa31861e51
commit 99cc856cb8
1 changed files with 33 additions and 33 deletions

@ -1,35 +1,35 @@
// Write your Javascript code. +(function($) {
var allowCircleToBlog = function(e) {
var allowCircleToBlog = function (e) {
var allow = $(this).prop('checked'); var allow = $(this).prop('checked');
var circleid = $(this).data('circle-id'); var circleid = $(this).data('circle-id');
var targetid = $(this).data('target-id'); var targetid = $(this).data('target-id');
var auth = { CircleId: circleid, BlogPostId: targetid }; var auth = { CircleId: circleid, BlogPostId: targetid };
var url = '/api/blogacl'; var url = '/api/blogacl';
if (!allow) url+='/'+circleid; if (!allow) url += '/' + circleid;
console.log(auth); console.log(auth);
$.ajax({ $.ajax({
url: url, url: url,
type: allow?'POST':'DELETE', type: allow ? 'POST' : 'DELETE',
data: JSON.stringify(auth), data: JSON.stringify(auth),
contentType: "application/json;charset=utf-8", contentType: "application/json;charset=utf-8",
success: function (data) { success: function(data) {
console.log('auth '+allow?'POSTed':'DELETEd'+' Successfully'); console.log('auth ' + allow ? 'POSTed' : 'DELETEd' + ' Successfully');
}, },
error: function () { error: function() {
console.log('auth not '+allow?'POSTed':'DELETEd'); console.log('auth not ' + allow ? 'POSTed' : 'DELETEd');
} }
}); });
e.preventDefault(); e.preventDefault();
}; };
$(document).ready(function(){ $(document).ready(function() {
$('input.Blogcirle[type=checkbox]').on('change',allowCircleToBlog); $('input.Blogcirle[type=checkbox]').on('change', allowCircleToBlog);
} });
);
var notifClick = function(nid) { $.get('/api/dimiss/click/'+nid).done(function() { var notifClick = function(nid) {
}) if (nid > 0) { 
.fail(function() { $.get('/api/dimiss/click/' + nid).done(function() {})
}) .fail(function() {})
.always(function() { .always(function() {});
}); }; }
};
})(jQuery);
Loading…