How do I ignore MIME types in ajax calls? The response header passes a JSON obje
ID: 3716403 • Letter: H
Question
How do I ignore MIME types in ajax calls?
The response header passes a JSON object, but it also passes the MIME type ("Content-Type", 'application/json');
JSON.parse(object) fails because the following MIME type is there. If I remove the MIME type and just pass the JSON object JSON.parse(object) works. But, that doesn't solve my issue. I need to be able to ignore MIME types in case someone adds it. How do I do that within an ajax call that has a condition JSON.parse(object) to see if its valid JSON.
Explanation / Answer
To tell the server what datatype we ajax is expecting in response, we need to use dataType keyword. So use below flag in your ajax call
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.