In the following code i am trying to make a post report system using Jquery ajax and php. When you click the .reportit
button of a post, you have to get the post id and then show popup form, and then when pressing the .report
button of this form, you have to execute the ajax after getting the id of the post and other information that will be sended to report_send_ajax.php
.
How can I combine the following code to do it?
$('.reportit').click(function(){
var i = $('.sikayet-et-alani').attr('id', $('.reportit').attr('id'));
$.ajax({
type: "POST",
url: 'report_send_ajax.php',
data: i,
beforeSend: function(){$("#posting").html('<img src="icons/ajaxloader.gif"/>'); },
success: function(html) {
//Do Something
}
});
});
with this code:
$(document).ready(function(){
$('.reportit').click(function(){
$('.vduzalani').animate({'opacity':'.50'}, 300, 'linear');
$('.sikayet-et-alani').animate({'opacity':'1.00'}, 300, 'linear');
$('.vduzalani, .sikayet-et-alani').css('display', 'block');
});
$('.close').click(function(){
close_box();
});
});
function close_box()
{
$('.vduzalani, .sikayet-et-alani').animate({'opacity':'0'}, 300, 'linear', function(){
$('.vduzalani, .sikayet-et-alani').css('display', 'none');
});
}
This is the JavaScript DEMO from codepen.io