On page 1, user clicks an image and a pop-up window allows an image file upload. The PHP page running this echo's back a json_encoded string that will include a variable called 'id'.
Here is an example of the response string:
"{"state":200,"message":null,"result":"..\/0images\/listimg\/mod\/20141215064959.jpeg","id":"570"}"  
When the pop-up modal closes, I would like an element (that was previously hidden on page 1) to now be displayed. The element is:
<div class="edit_right">
My logic is to show the element if an 'id' is sent as JSON data, thus if ID is not null, element will show. The JS I am troubleshooting is
    <script>
        $(document).ready(function(){
            $(".edit_right").hide();
        });
    $('#modal').on('hidden.bs.modal', function () {
        function handleResponse(data){
    console.log(data);
    }
        $.getJSON(crop-avatar.php)
            .done(function(data) {
             if (data.id !== null){
              $(".edit_right").show();
             } else {
            $(".edit_right").hide();
            }
         });
       })
    </script>
and is located right before the end body tag. This script doesn't work, the element is always hidden. How can I correct this?
 
     
     
     
    