I've got a jQuery function that retrieves a JSON response from a PHP page. One of the parameters passed to getJSON() is a year. If I pass an int (2008) Firebug reports a 404 error and the getJSON call fails, but if I pass a string (x2008) Firebug reports a 200 code and fires the callback. In both cases the PHP page returns an identical response -- it automatically detects x2008 as invalid and uses the default of 2010 instead -- and Firebug shows that it received the response. It fails if I pass the int as a string, too ('2008').
Here's the getJSON call:
$mr.getJSON(controller, {call: 'getWeekList', year: '2008'}, function(data)
{
var newList = '';
$mr.each(data, function(index, value)
{
newList += '' + value + '';
} );
newList += '';
$mr("#selectWeekList").html(newList);
} );
Firebug reports a correct response, even though it says there was a 404:
{"1":"December 30th - January 5th","2":"January 6th - January 12th","3":"January 13th - January 19th","4":"January 20th - January 26th","5":"January 27th - February 2nd","6":"February 3rd - February 9th","7":"February 10th - February 16th","8":"February 17th - February 23rd","9":"February 24th - March 1st","10":"March 2nd - March 8th","11":"March 9th - March 15th","12":"March 16th - March 22nd","13":"March 23rd - March 29th","14":"March 30th - April 5th","15":"April 6th - April 12th","16":"April 13th - April 19th","17":"April 20th - April 26th","18":"April 27th - May 3rd","19":"May 4th - May 10th","20":"May 11th - May 17th","21":"May 18th - May 24th","22":"May 25th - May 31st","23":"June 1st - June 7th","24":"June 8th - June 14th","25":"June 15th - June 21st","26":"June 22nd - June 28th","27":"June 29th - July 5th","28":"July 6th - July 12th","29":"July 13th - July 19th","30":"July 20th - July 26th","31":"July 27th - August 2nd","32":"August 3rd - August 9th","33":"August 10th - August 16th","34":"August 17th - August 23rd","35":"August 24th - August 30th","36":"August 31st - September 6th","37":"September 7th - September 13th","38":"September 14th - September 20th","39":"September 21st - September 27th","40":"September 28th - October 4th","41":"October 5th - October 11th","42":"October 12th - October 18th","43":"October 19th - October 25th","44":"October 26th - November 1st","45":"November 2nd - November 8th","46":"November 9th - November 15th","47":"November 16th - November 22nd","48":"November 23rd - November 29th","49":"November 30th - December 6th","50":"December 7th - December 13th","51":"December 14th - December 20th","52":"December 21st - December 27th"}
Here are the headers Firebug reports:
Response Headers
Date Fri, 17 Sep 2010 00:07:41 GMT
Server Apache/2.0.52 (CentOS)
X-Powered-By PHP/5.1.6
Expires Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control no-cache, must-revalidate, max-age=0
Pragma no-cache
Set-Cookie [redacted]
X-Pingback [redacted]
Last-Modified Fri, 17 Sep 2010 00:07:42 GMT
Content-Length 1690
Content-Type text/html; charset=UTF-8
X-Cache MISS from [redacted], MISS from [redacted]
X-Cache-Lookup MISS from [redacted], MISS from [redacted]
Via 1.0 [redacted] (squid/2.6.STABLE22), 1.0 [redacted] (squid/2.6.STABLE22)
Connection close
Request Headers
Host [redacted]
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100824 Firefox/3.6.9
Accept application/json, text/javascript, */*
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Connection keep-alive
Content-Type application/x-www-form-urlencoded
X-Requested-With XMLHttpRequest
Referer [redacted]
Cookie [redacted]
The response seems identical when it works and when it doesn't, and obviously it wasn't actually a 404 since it got the response, so I can't figure out why Firebug thinks there's a 404 and fails.