Here is a sample of my code, i've removed the unnecessary parts.  I've set a global variable recipient.  It should be alert 1 but nothing is being alerted.  What is the correct way to change a variable set outside a function?  How do i solve this?
var recipient = 0;
$("#submit-button").click(function () {
    $.getJSON("/fetch.php?o=4&user=" + k, function (B) {
        $.each(B, function (index, result) {
            recipient = 1;
        })
    })
    if (recipient == 1) {
        alert("yes");
    }
})
 
     
     
    