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 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 be able to send a simple post from an ASP code.
I want to make a POST request to my Controller with jquery. function Send()
Ultimately I have to send form post data from an iPad app to a
i want to send a json string from a html webpage using javascript to
I want to send a variable from my php page to my jquery code.
I want to set headers like post variable name and the value and send
Want to send the text from my current vb application to the Active Window
I need to know it to correctly get filedata from POST dictionary. I want
Is it possible to make an HTML form that responds to the number of
I am trying to send an email from a CakePHP controller with the url

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.