title: Can you handle both json and html datatypes in the same ajax call?
body: <p>Is there anyway I can handle both json and html return types when posting jquery ajax:</p>
  
  <p>For example, this ajax call expects html back</p>
  
  <pre><code>$.ajax({
              type: "POST",
              url: url
              data: data,
              dataType: "html",
              success: function (response) {
                  var $html = "&lt;li class='list-item'&gt;" + response + "&lt;/li&gt;";
                  $('#a').prepend($html);                           
              },
              error: function (xhr, status, error) {
                  alert(xhr.statusText);
              }
          });
  </code></pre>
  
  <p>but I wanted to modify it so that I can return a json object if there is a model error.  so I can do something like this:</p>
  
  <pre><code>success: function (response) {
            if (response.Error){
                   alert(response.Message);   
            } else {
                var $html = "&lt;li class='list-item'&gt;" + response + "&lt;/li&gt;";
                $('#a').prepend($html);                           
            }
  </code></pre>
  
  <p>Is this possible?</p>