{"id":6039,"date":"2014-04-12T02:53:23","date_gmt":"2014-04-12T02:53:23","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/12\/getjson-ajax-is-sent-but-callback-function-is-ignored-internet-explorer-collection-of-common-programming-errors-2\/"},"modified":"2014-04-12T02:53:23","modified_gmt":"2014-04-12T02:53:23","slug":"getjson-ajax-is-sent-but-callback-function-is-ignored-internet-explorer-collection-of-common-programming-errors-2","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/12\/getjson-ajax-is-sent-but-callback-function-is-ignored-internet-explorer-collection-of-common-programming-errors-2\/","title":{"rendered":"$.getJSON &#8211; ajax is sent but callback function is ignored &#8211; Internet Explorer-Collection of common programming errors"},"content":{"rendered":"<p>As it fails in specific browsers, it&#8217;s likely that it is a combination of unexpected headers in the response, and how the browser handles the data based on that.<\/p>\n<p>If for example the response has the content type <code>text\/html<\/code> instead of <code>application\/json<\/code>, the browser might try to turn the response content into a HTML document (by adding <code>pre<\/code> tags around it), which would then cause the JSON parsing to fail.<\/p>\n<p>If you use the <code>$.ajax<\/code> method, you can also catch any error message, which would give you a clue to what&#8217;s going on:<\/p>\n<pre><code>$.ajax({\n  url: addr,\n  dataType: 'json',\n  success: function(data){\n    alert('whoooo working'); \/\/<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>As it fails in specific browsers, it&#8217;s likely that it is a combination of unexpected headers in the response, and how the browser handles the data based on that. If for example the response has the content type text\/html instead of application\/json, the browser might try to turn the response content into a HTML document [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6039","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6039","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6039"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6039\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6039"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6039"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}