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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:28:48+00:00 2026-05-21T09:28:48+00:00

I want to send a post from HTML that contains info about a certain

  • 0

I want to send a post from HTML that contains info about a certain form to a controller in code igniter. The I want the controller to process the info and loads a certain page inside a div. Here is my code. I think I’m supposed to use something like .html or something? I’m not quite sure, I dont understand it

The controller

function search_friend(){

    //this function gets text from text field and searches for a user and returns all users similar to this dude
    // $this->input->post($searchFriendForm);
    // $this->input->post($searchFriendText);

    $this->load->model('userProfile_m');

    $people = $this->userProfile_m->get_user_by_name($this->input->post($searchFriendText));

    $this->load->view('addFriendSearchResult',$people);

    }

the form in html

<form method="post" action="" name="searchFriendForm" id="add-friend-search">
<input type="text"/ name="searchFriendText">
<input type="button" class="small green button" id="add-friend-button" />


</form>

the jquery function

$("#add-friend-button").click(function(){ //start click



        $.post("<?php echo site_url('userProfile/search_friend'); ?>", $("#add-friend-search").serialize());

        $("#insert-activity").load("<?php echo base_url().''?>system/application/views/addFriendSearchResult.php");

        $("#add-friend-search").slideUp("slow",function(){});

    }); //end click
  • 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-21T09:28:49+00:00Added an answer on May 21, 2026 at 9:28 am

    Firstly, in your controller change this line like this (u need to pass the string name of the field here):

    $people = $this->userProfile_m->get_user_by_name($this->input->post('searchFriendText'));
    

    Next, change your jQuery to be like this:

    $("#add-friend-button").click(function(){ //start click
        $.post("<?php echo site_url('userProfile/search_friend'); ?>", 
            $("#add-friend-search").serialize(),
            function(data){
               $("#insert-activity").html(data);
            });
    
        $("#add-friend-search").slideUp("slow",function(){});
    }); //end click
    

    You cant call your view directly, and you don’t need to. The post should return the data, which you can write out to your #insert-activity element.

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

Sidebar

Related Questions

I want to make a POST request to my Controller with jquery. function Send()
I want to send some strings in a list in a POST call. eg:
I want so send every week an update by email. But Im afraid that
I want to send email from a Ruby application. Is there a call in
I just want to send SMS from my web application in PHP. Can anyone
Is it possible to make an HTML form that responds to the number of
Hello I want to post some data from silverlight to a website. I found
I'm in the process of porting some code from Linux to Mac OS X.
For testing purposes I want send mail to my localhost user account rather than
I want to send an array constructed in javascript with the selected values of

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.