So I've made an AJAX request, it submits fine and returns the HTML on success as expected - but in the HTML that is returned to the target div element, it has a button. I've added jQuery to this, that when it's clicked, it is to hide the HTML from the AJAX success.
In short: I want the close button to close the div, but it doesn't seem to be working.
$('#user_report__dd #make_report').click(function(){
var interaction_type = $(this).data('interaction_type');
var user_id = $(this).data('user_id');
$.ajax({
type: 'POST',
dataType: 'html',
url: ajax_url,
data: {
interaction_type: interaction_type,
user_id: user_id,
},
success:function(html){
// $('.ajax_call').html(html);
$('.ajax_call').html(html);
// stop body from scrolling
}
});
});
if(isset($_POST['interaction_type']) && $_POST['interaction_type'] == 'report_user'){
global $report;
$report->Form($_POST['user_id'], 'user');
// This returns the HTML
}
And then in my main jQuery file
$('.close').click(function(){
$(this).parents('.pulled_in_html');
});