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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:38:04+00:00 2026-05-31T13:38:04+00:00

When ever I am doing an ajax request with jquery I always get an

  • 0

When ever I am doing an ajax request with jquery I always get an error 500 return,

I am posting to the following URL

http://localhost/domain/index.php/my_profile/interests_music

using this javascript,

$("#add").click(function(e){

    //set some process variables, we need to get the forms action, 
    //and any post data it is sending appending isAjax into the params
    //gives us a point in the controller to gracefully check for ajax.
    var action = $(this).parent('form').attr('action');
    var formData = $(this).parent('form').serialize()+"&isAjax=1";

    $.ajax({
        type: "POST",
        url: action,
        data: formData
    }).done(function( msg ) {
        alert( "Data Saved: " + msg );
    });

    e.preventDefault();
});

The params that are being sent are,

music=Savage Garden&isAjax=1

And the PHP method the ajax is requesting looks like this,

public function interests_music()
{
    if($this->input->post('music'))
    {
        $this->rest->initialize(array('server' => 'https://www.googleapis.com/freebase/v1'));
        $response = $this->rest->get('mqlread?query={"type":"/music/artist","name":"' . urlencode($this->input->post('music')) . '","id":[]}');
        $data['image'] = 'https://usercontent.googleapis.com/freebase/v1/image'.$response->result->id[0].'?mode=fillcrop&maxwidth=80&maxheight=80';
        $data['category'] = 'music';
        $data['user_id'] = $this->session->userdata('id');
        $data['name'] = $this->input->post('music', TRUE);

        $this->profile_model->add_interest($data);

        Events::trigger('interests_music');
        Events::trigger('badge_stagediver');

        if($this->input->post('isAjax') == 1)
        {
            echo json_endcode($data);
            $this->_buttons();
        }

        redirect('my_profile/interests');
    }
    else
    {
        show_404();
    }
}

Am I missing something, is this a common problem?

  • 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-31T13:38:05+00:00Added an answer on May 31, 2026 at 1:38 pm

    Well for one there’s a typo in your PHP which could be what your server is choking on: echo json_endcode($data); should be echo json_encode($data);. Aside from that there could be other issues with your HTTP server. What server are you using? A good practice is to find the server error log and PHP error log and use tail -f or some other method of monitoring the logs which should give you more information when you have 505s.

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

Sidebar

Related Questions

This is the first time I've ever tried JQuery basically because I couldnt get
http://www.php.net/manual/en/features.remote-files.php The only time I could ever think of doing include( http://someotherserver/foo.php ) would
If I wanted to do a GET request I could just use document.location =
i am doing a jquery back end search of data from a DB table..until
I'm experiencing something odd here, that I don't recall ever running into. I'm doing
I have written a jquery ajax function that I have added to js file
I've been doing my annual attempt to learn Haskell this weekend, and as ever
Has anyone ever gotten this error or know what it relates to? I got
well I havn't really ever using jquery to grab data from a server.. and
I'm trying to write my first ever bit of AJAX, reading the public tmeline

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.