I'm trying to add a simple popup window to my Django app. How it works is when I press the Yes button, it sends a request to my Django views. However, I want it to automatically close after I press Yes. Unfortunately, the problem with putting it directly in my "click" function is that it closes the window altogether without sending a request to my Django views.
That is why I wanted to add a variable "clicked". After the button is clicked, I want it to change the variable value to "true" so that I can run an if statement ultimately to close the window. For some reason, the popup window automatically closes when I try to open it. My guess is that the if statement is not working properly? Thank you for your help!
$(document).ready(function(){
var clicked=false;
var deleteid;
$('#yes').click(function(){
deleteid = $(this).attr("data-deleteid");
$.get ('../../delete_function/', {delete_id:deleteid}, function(data){});
clicked = true;
});
if (clicked = true){
window.close();
}
});
clicked = trueis assignmentclicked == trueis check - ALso, this needs to be checked in the.getmethod's callback.{}of the call back - This check, andclicked=true../..