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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:44:20+00:00 2026-06-06T16:44:20+00:00

Basically, I want the value to be passed from one div to other div

  • 0

Basically, I want the value to be passed from one div to other div through ajax call on success in the same page.

But still, I am able to do it
using another page which get the value from div .And on success, the value is load to the other div.

Here are my codes:

My index.pl has following code.

 while($query->fetch()) {
    print qq( "<option id='$tblname_id'>$tblname_name</option>" );
 }

print "<div id='body'></div>";

My script.js contains following code.

$(document).ready(function(){
 $('option').click(function(){
    var selected=$(this).val();
    var id=this.id;
    //alert(id);   //here I am getting the id of selected option
    $.ajax({
        type:"get",
        url:"hello.pl", //instead of hello.pl,I want to do with index.pl itself
        data:{'id':id},
        success: function(msg){
                   $("#body").html(msg);
                   $("#body").show();
            }
    });
  });
});

Hello.pl contains

  $obt_id=$q->param('id');

This one works. But when I do same with index.pl, it doesn’t.

Where is the problem?

In one line, my question is simple.

How to get value in a div through ajax call, sent from other div, in the same page?

  • 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-06T16:44:21+00:00Added an answer on June 6, 2026 at 4:44 pm

    How to get value in a div through ajax call, sent from other div ,in
    the same page ?

    Take a look at jQuery’s load() function. An Example:

    $('#result').load('test.html #foo');
    

    That would get contents of an element with id=foo and append the results to an element with id=result

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

Sidebar

Related Questions

Basically I want to alter the boolean value selecting from the table: e.g.: SELECT
I basically want the same functionality as facebook, twitter and all those other infinite
Basically I want to get the value of a textbox which is to select
i bascially want to get the value of a variable from the codebehind to
Basically i want to update my database with values from an array that i
I basically want something like: TextView Button Button . . . TextView TextView SeekBar
I basically want to setup a relationship similar to Netflix's DVD rental model. There
I basically want to do: git checkout branchA git checkout -b branchB <commit_id> which
I basically want to do this in code: PersonList myPersonList; //populate myPersonList here, not
Basically I want to implement something similar to the the cell-coloring which is defined

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.