Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1092185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:38:39+00:00 2026-05-16T23:38:39+00:00

I’ve got a jQuery function that retrieves a JSON response from a PHP page.

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:38:39+00:00Added an answer on May 16, 2026 at 11:38 pm

    Have you tried to set the status code to the headers when you are building the JSON in the php page?

    header($_SERVER["SERVER_PROTOCOL"]." 200 OK");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I'm making a simple page using Google Maps API 3. My first. One marker
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.