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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:44:08+00:00 2026-06-07T00:44:08+00:00

I have this page which has three peson searchs on them. Basically it’s a

  • 0

I have this page which has three peson searchs on them. Basically it’s a textbox and button. When you click the button it takes the text in the associated textbox and should populate the associated results with list data.

    <div class="personcontainer">
        <div class="peoplesearchdiv" >

        <input type="text" class="searchpersontxtbox" />
        <input type="button" value="Find" class="findpersonbtn" />
        <div class="peopleresultsdiv"></div>
    </div>
    <input type="hidden" class="personguid" />

<div class="personcontainer">
        <div class="peoplesearchdiv" >

        <input type="text" class="searchpersontxtbox" />
        <input type="button" value="Find" class="findpersonbtn" />
        <div class="peopleresultsdiv"></div>
    </div>
    <input type="hidden" class="personguid" />

<div class="personcontainer">
        <div class="peoplesearchdiv" >

        <input type="text" class="searchpersontxtbox" />
        <input type="button" value="Find" class="findpersonbtn" />
        <div class="peopleresultsdiv"></div>
    </div>
    <input type="hidden" class="personguid" />

Ok, so the jquery to try to get this working is:

$(document).ready(function () {

    $('.findpersonbtn').click(function () {

    var query = $(this).closest('.personcontainer').find('.searchpersontxtbox').val();

    $.get('/People/GetPeople/', { 'query': query }, function (data) {         

        $(this).closest('.peoplesearchdiv').find('.peopleresultsdiv').html(data);

    });

});

Returned from GetPeople is basic list data eg.

<ul>
  <li>Cat</li>
  <li>Dog</li>
</ul>

So what I was wanting to happen was the list data to populate the html to the peopleresultsdiv within the same personscontainer.

Doesn’t work though.

To eliminate it being the GetPeople method I changed the jquery to:

$(document).ready(function () {

        $('.findpersonbtn').click(function () {

        var query = $(this).closest('.personcontainer').find('.searchpersontxtbox').val();

        $.get('/People/GetPeople/', { 'query': query }, function (data) {         

            $(this).closest('.peoplesearchdiv').find('.peopleresultsdiv').html("<ul><li>Cat</li><li>Dog</li></ul>");

        });

    });

Still doesn’t work.

So I tried:

$(document).ready(function () {
    $('.findpersonbtn').click(function () {

        var query = $(this).closest('.personcontainer').find('.searchpersontxtbox').val();

        $(this).closest('.peoplesearchdiv').find('.peopleresultsdiv').html("<ul><li>Cat</li><li>Dog</li></ul>");

        $.get('/People/GetPeople/', { 'query': query }, function (data) {


        });

    });

Hmmmmmm. Now the list is appearing. Obviously not what I want though because I’m not getting to populate from the method.

So it appears the closest find won’t work inside the get?

Anyone know why how to fix?

  • 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-07T00:44:10+00:00Added an answer on June 7, 2026 at 12:44 am

    Inside $.get having $(this) doesn’t return peopleresultsdiv.

    So, you can get the required div outside $.get and have it in a variable, and use that inside $.get

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

Sidebar

Related Questions

I have a aspx page which has three tabs. When I click a button
I have a page which has document.body.onload=function(){...} but this is suffering delays because the
This may sound a weird question, I have a page which has a link:
I have a page which has three components: suggested items, suggested people, and a
I have a web page which has three <div> elements: Right_bar contains several layouts
I have a form which has three inputs when the page loads -- 2
I have this html page which is very simple, it contains a text box
I have one master page which applies to all pages in this website. On
On my main page I have this jquery code which does an ajax call
I have a javascript page which checks an email and username, this works fine

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.