title: ajax call returning different datatypes?
body: <p>I have the following ajax call: </p>
  
  <pre><code>                $.ajax({
                  type: "post",
                  dataType: "html",
                  url: '@Url.Content("~/RBA/Tools/_Actions")',
                  data: $("#actionForm").serialize(),
                  success: function (response) {
                      debugger;
  
                      $("#DetailsEdit").removeClass('zoomInDown');
                      $("#DetailsEdit").addClass('flipInX');
  
                      $("#DetailsRefresh").html(response);
                      $("#actionPlaceholder").hide();
  
                      $("#dashSpinner").hide();
  
                  },
                  error: function (response) {
                      debugger;
  
                      $("#dashSpinner").hide();
                      swal({
                          title: "Error",
                          text: response.responseText,
                          type: "error",
                          showConfirmButton: true
                      });
  
                  }
  
              });
  </code></pre>
  
  <p>I am having a problem with the error portion as it is returning html to me. When I run the MVC on my local machine, I am getting the error message displayed properly in a pop up box. When I deploy the application to another server, I am getting some lengthy html message which is really awkward. How do I fix this issue? </p>
  
  <p>Here is my catch exception block of the controller that this ajax call is calling:</p>
  
  <pre><code>            catch (Exception e)
          {
              log.Error(e);
  
              if (e.Message.Contains("Is not a valid cause category."))
                  error = "The selected category is not a valid category. Please choose another category.";
              else
                  error = "You cannot take this type of action.";
  
              Response.StatusCode = 500;
  
              return Json(error);
          }
  </code></pre>
  
  <p>I know that my dataType in the ajax call is listed as html and I need the ajax call to return html when it is successful so that it can bring up another view. But in my error, I want to get a string so it can display the message to the sweetalert box. How do I accomplish this?</p>
  
  <p>Thanks in advance</p>