Here is a scenario. I am submitting a form via AJAX. The form may either return HTML (when there are input errors) or JSON (successful response). If during request I specify "dataType: 'json'" then HTML doesn't get thru correctly, if I don't then JSON is displayed as plain text.
I am sending the "application/json" header back correctly. I don't understand why doesn't jQuery just pick that up and parse it as JSON? Is there an option? Is there something I can do to make this work? Thank you!