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 6223033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:25:08+00:00 2026-05-24T08:25:08+00:00

I was developing a site on my computer and was able to get AJAX

  • 0

I was developing a site on my computer and was able to get AJAX requests with jQuery working fairly painlessly. On the production server, however, I’m running into problems.

This is how the CodeIgniter controller I have returns a result:

# Return that everything worked.
$return = array('result' => 'success', 'data' => $item);
echo json_encode($return);

And this is some sample jQuery code:

$.post("../../../list/vote/", { 'item_id' : item_id, 'value' : 0, 'action' : 'delete' },
function(data) {
    if(data.result || !data.result) {
        if(votes == null) votes = 0;
        $(button).children('strong').text(--votes);
        $(button).attr('name', '').removeClass('vote_cast');
        $(button).parent('.meta').attr('name', '');
    }
}, "json");

The problem is that PHP is returning a 200 OK status but no response is shown in Firebug. Since nothing is being returned, jQuery is saying data is null.

I’m using MAMP locally (PHP/5.3.5) and PHP/5.3.2-1ubuntu4.9 on the server. It works locally but not on the server. What could be wrong?

EDIT: Some more info. This is happening for every AJAX request on my site in the production server. The request actually goes through (votes are cast, items are added, etc…), it’s just that jQuery isn’t informed of the result (which explains why data is null).

UPDATE: Scott Harwell figured it out. After I echo’d the json_encode, PHP continued trying to process the rest of the code. It was fixed by adding exit(); after each echo json_encode();.

  • 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-24T08:25:09+00:00Added an answer on May 24, 2026 at 8:25 am

    Looks like you are accessing the vote page with relative paths. Have you tried explicitly writing the path or give a proper url instead of ../../../list/vote?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an ASP.net site (using .NET 4, EF, jQuery Ajax, SQL Server
I'm developing a site that uses OpenID for authentication, which is working fine however...
I'm developing a site where I want to get all the links from a
I am working in drupal 7 for developing site. I am using webform for
I am developing site with WordPress and I'm newbie for WordPress. WP adds <p>
I'm developing a site in Visual Web Dev Express, and when I run/debug, I'd
I've been developing a site using ASP.NET MVC, and have decided to use the
Currently I am developing a site with about seven partial classes, a few icons,
I'm developing a site-specific Firefox extension. The official hosting/updating mechanism at addons.mozilla.org forces my
I am developing a site using asp.net and C# ( framework 1.1 ). Theres

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.