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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:33:30+00:00 2026-06-01T13:33:30+00:00

I want to do the search using ajax jquery js, for that I have

  • 0

I want to do the search using ajax jquery js, for that I have taken this piece of code from here:-

Now i have some issues, I have this Javascript code:-

<script language="JavaScript" type="text/javascript">
<!--
function searchuser(cv) {
    $("#SearchResult").html('<img src="loader.gif"/>').show();
    var url = "elements/search-user.php";
    $.post(url, {contentVar: cv} ,function(data) {
       $("#SearchResult").html(data).show();
    });
}
//-->
</script>

My Form:-

<label>
        <input onClick="generatenew();" type="radio" name="search_option" value="code" id="search_option_0">
        Customer Code</label></td>
      <td><label>
        <input onClick="generatenew();" type="radio" name="search_option" value="company" id="search_option_1">
        Customer Company</label></td>
      <td><label>
        <input onClick="generatenew();" type="radio" name="search_option" value="name" id="search_option_2">
        Customer Name</label></td>
      <td><label>
        <input onClick="generatenew();" type="radio" name="search_option" value="email" id="search_option_3">
        Customer Email</label>

This is my search textbox

<input type="text" name="searchuser_text" id="newInput" size="25" maxlength="25" class="inputbox MarginTop10">

This is my search button

<input onclick="javascript:searchuser('con1');" class="Button" name="search_user_submit" type="button" value="Search">

This is my Display Area :-

<div id="SearchResult">My default content for this page element when the page initially loads</div>

Now i want to know on click of button i am sending a data i.e. con1. I want to send two data to the searchuser function, one the selected option button value and the another one is the text in the textbox. After sending both the data to the function how will i get the data in the function? Do i need to change the function searchuser(cv) to function searchuser(cv, cvtwo).

Also while the $.post(url, {contentVar: cv} ,function(data) is sending only one data to the php file, how can i send both the data i.e. cv and cvtwo to the php file?

  • 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-01T13:33:31+00:00Added an answer on June 1, 2026 at 1:33 pm

    First of all you can modify the search function to something like this

    $("input[name='search_user_submit']").click(function(){
    var cv = $('#newInput').val();
    var cvtwo = //similar to above
    var data = 'cv='+ cv + '&cvtwo='+cvtwo; // sending two variables
    $("#myDiv").html('<img src="loader.gif"/>').show();
        var url = "elements/search-user.php";
        $.post(url, {contentVar: data} ,function(data) {
           $("#SearchResult").html(data).show();
        });
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently using ajax and jquery to update search results with a form that
This is a JavaScript/Ajax webpage (also using jQuery). I have a nested structure I
i have an input using the jquery autocomplete plugin. with this i want to
I'm using django and have a page of search results that I want to
We have a thick client app using jQuery heavily and want to profile the
I have a search that returns an AJAX(MVC AJAX Form) grid, and, in the
I am using jQuery to load the search results from a php class when
I'm using the jQuery Autocomplete control to autocomplete from the server via an AJAX
i m a beginner... here i m using the jquery for showing search results
I have some checkboxes that act as search filters. These search filters trigger an

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.