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

  • Home
  • SEARCH
  • 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 8323499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:44:22+00:00 2026-06-08T23:44:22+00:00

I ve been trying to post something using ajax but I m getting a

  • 0

I ve been trying to post something using ajax but I m getting a Failed to load resource: the server responded with a status of 500 (Internal Server Error). All other forms on the site using ajax work this is the only one that’s giving the error. Not sure what is going on … maybe someone will notice something I m not.

jQuery
(user_id is already defined in the view. alert returns everything I need to pass to the controller)

$('.one_add').submit(function(e) {
            e.preventDefault();

            var formID = $(this).attr('id');
            var formIDSplit = formID.split('-');
            var oneID = formIDSplit[1];

            var url = $('.one-link-'+oneID).val();
            var desc = $('.one-link-desc-'+oneID).val();

            $.post(base_url + "index.php/home/one_link", { user_id : user_id, one_id : oneID, desc : desc, url : url  }, function(data)
            {
            }, "json");

//              alert(user_id+'-'+oneID+'-'+desc+'-'+url);
});

The form

 <?php
      $attributes = array('class' => 'one_add', 'id' => 'add-'.$job->id.'');
      echo form_open('ajax/add_one_link', $attributes ); ?>
      <input type="text" class="one-link-<? echo $job->id; ?>" value="Url" />
      <input type="text" class="one-link-desc-<? echo $job->id; ?>" value="Description" />
      <button type="submit">Go!</button>

 <?php echo form_close(); ?>

The controller function

function one_link()
    {
            $this->load->model('one_add_model');

            $this->form_validation->set_rules('user_id', 'trim|required|xss_clean');
            $this->form_validation->set_rules('url', 'trim|required|xss_clean|strtolower');
            $this->form_validation->set_rules('desc', 'trim|required|xss_clean|strtolower');
            $this->form_validation->set_rules('one_id', 'trim|required|xss_clean');

            $user_id = $this->input->post('user_id');
            $url = $this->input->post('url');
            $desc = $this->input->post('desc');
            $one_id = $this->input->post('one_id');

            $this->one_add_model->add_url($user_id, $url, $desc, $one_id);
    }

The model

function add_url($user_id, $url, $desc, $one_id);
{
     $query_str = "INSERT INTO one_add (`user_id`, `url`, `desc`, `one_id` ) VALUES (?, ?, ?, ?)";
     $this->db->query( $query_str, array($user_id, $url, $desc, $one_id) );
}
  • 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-06-08T23:44:23+00:00Added an answer on June 8, 2026 at 11:44 pm

    This was finally showing

    Message:  Undefined property: Home::$form_validation
    

    And I just loaded the form validaton which was not loaded. But it was in another controller and was causing the same error. Not sure what happened … but it works now.

                $this->load->library('form_validation');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’ve been trying to post geolocation-targeted status updates on a Page through the Graph
I have been trying to post using RestKit after I have successfully used it
I've been trying to get this really simple example of using AJAX with JQuery
There's got to be something I'm missing. I've tried using $.ajax() and $.post() to
this is my first post, and it covers something which I've been trying to
So I am getting better at using phonegap but am still trying to fully
I have been trying to do a query using Microsoft SQL Server 2008 R2,
I've been trying to serialize an XML (jQuery object) to string to POST it
Been trying to figure this out, but can't come up with a good solution
I've been trying to write a ruby script using mechanize to batch upload a

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.