Fixes a 500 @ api/dimiss
This commit is contained in:
@ -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);
|
Reference in New Issue
Block a user