title: Get Json value from controller to jquery
body: <p>I have a JS function:</p>
  
  <pre><code>$(document).on('click', '#submitForm', function (e) {
  var fileName = $('#fileName').val();
  $.ajax({
      type: 'POST',
      url: '/Calculation/FileExist',
      data: { 'fileName': fileName },
      dataType: 'bool',
      success: function (result) {
          if (result.returnvalue) {
              e.preventDefault();
              alert(result.returnvalue);
              alert("The filename already exists. Please choose another one");
          }
          else {
              alert("The file doesn't exist");
          }
      }
  });
  });
  </code></pre>
  
  <p>My action:</p>
  
  <pre><code>    public ActionResult FileExist(string fileName)
      {
          bool result = true;
          string path = Server.MapPath(TempPath) + fileName + ".xlsx"; //Path for the file
          string[] Files = Directory.GetFiles(Server.MapPath(TempPath));
          for (int i = 0; i &lt; Files.Length; i++)
          {
              if (path == Files[i])
              {
                  //The filename already exists
                  result = false;
              }
          }
          return Json(new { returnvalue = result });
      }
  </code></pre>
  
  <p>What am I doing wrong here? I'm trying to get the bool value from FileExist method, and if it's true stop the form from submitting (e.preventDefault)</p>