'Ajax call not working within another function

I am trying to make an Ajax call from within a function. The idea is to save images and return a positive (1) or negative(0) value. The image loads fine but the code does not continue on to the Ajax call.

<script type="text/javascript">
var loadFile = function (imgTag, lStoreID, lStoreProductID) {
  var image = document.getElementById(imgTag);
  image.src = URL.createObjectURL(event.target.files[0]);

  $.getJSON(
    '/ajax/InsertStoreProductPhoto1/' + file_data + "," + lStoreID + "," + lStoreProductID, 
    function (result) {
      alert(result);
    }
  );
</script>

Thanks for the help



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source