{"id":194,"date":"2008-09-05T12:44:15","date_gmt":"2008-09-05T20:44:15","guid":{"rendered":"http:\/\/www.codebelay.com\/blog\/?p=194"},"modified":"2008-09-05T12:49:48","modified_gmt":"2008-09-05T20:49:48","slug":"the-http-status-122-error-in-ie7-in-ajax-apps","status":"publish","type":"post","link":"https:\/\/www.codebelay.com\/blog\/2008\/09\/05\/the-http-status-122-error-in-ie7-in-ajax-apps\/","title":{"rendered":"The HTTP Status 122 Error in IE7 in Ajax Apps"},"content":{"rendered":"<p><strong>Summary: Don&#8217;t use the GET method in Ajax Apps, if you can void it, because IE7 craps out with more than 2032 characters in a get string.<\/strong><\/p>\n<p>Here&#8217;s the page that craps out at 2033 characters <strong>with IE7<\/strong>:<a href=\"http:\/\/www.codebelay.com\/status122\/?i_limit=2033\"><br \/>\nhttp:\/\/www.codebelay.com\/status122\/?i_limit=2033<\/a><\/p>\n<p>You won&#8217;t see the error with other browsers.<\/p>\n<p>Here&#8217;s the page that&#8217;s okay:<br \/>\n<a href=\"http:\/\/www.codebelay.com\/status122\/?i_limit=2000 \">http:\/\/www.codebelay.com\/status122\/?i_limit=2000<\/a><\/p>\n<p>What&#8217;s going on here?<\/p>\n<p><a href=\"http:\/\/www.codebelay.com\/status122\/?i_limit=2033\"><img decoding=\"async\" src=\"http:\/\/codebelay.com\/img\/status122.png\" alt=\"picture of http status 122\" width=\"500\" \/><\/a><br \/>\nSometimes you&#8217;ll write a piece of Javascript that uses <a href=\"http:\/\/prototypejs.org\/\">prototype<\/a> and looks like this:<\/p>\n<pre>\r\n  var url = '\/status122\/listener\/?stuff=' + encodeURIComponent($('js_stuff').innerHTML);\r\n\r\n  \/\/ This is where we send our raw ratings for parsing\r\n  var ajax = new Ajax.Updater(\r\n\t 'jskitdecoded',\r\n\t url,\r\n\t {\r\n\t\tmethod: 'get',\r\n\t\tonComplete: showResponse\r\n\t }\r\n  );\r\n\r\n<\/pre>\n<p>If you print http.status you get an HTTP Status of 122. WTF?<\/p>\n<p>What&#8217;s going on here is that IE7 sets a limit of 2032 characters on GET strings, so you have to do a POST instead like so:<\/p>\n<pre>\r\n  var getvar = encodeURIComponent($('js_stuff').innerHTML);\r\n  var url = '\/status122\/listener\/';\r\n\r\n  \/\/ This is where we send our raw data for parsing\r\n  \/\/ If we use method: 'get', IE7 will return a 122, but\r\n  \/\/ b\/c Firefox is RFC2616 compliant and realizes that\r\n  \/\/ there is no minimum length for a URI, we get success.\r\n  \/\/ Here we use method: 'post' b\/c IE7 is lame.\r\n  var ajax = new Ajax.Updater(\r\n\t 'jskitdecoded',\r\n\t url,\r\n\t {\r\n\t\tmethod: 'post',\r\n\t\tpostBody: 'stuff=' + getvar,\r\n\t\tonComplete: showResponse\r\n\t }\r\n  );\r\n<\/pre>\n<p>I hope this helps. <\/p>\n<p>What Ajax quirks have you run into?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Don&#8217;t use the GET method in Ajax Apps, if you can void it, because IE7 craps out with more than 2032 characters in a get string. Here&#8217;s the page that craps out at 2033 characters with IE7: http:\/\/www.codebelay.com\/status122\/?i_limit=2033 You won&#8217;t see the error with other browsers. Here&#8217;s the page that&#8217;s okay: http:\/\/www.codebelay.com\/status122\/?i_limit=2000 What&#8217;s going [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,33],"tags":[136,137,138,139],"class_list":["post-194","post","type-post","status-publish","format-standard","hentry","category-how-to","category-webapps","tag-ajax","tag-http-status-122","tag-ie7","tag-prototype"],"_links":{"self":[{"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/posts\/194","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/comments?post=194"}],"version-history":[{"count":0,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/posts\/194\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/media?parent=194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/categories?post=194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/tags?post=194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}