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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:26:20+00:00 2026-06-13T14:26:20+00:00

I’ve been working on this for hours and having alot of difficulty- been unable

  • 0

I’ve been working on this for hours and having alot of difficulty- been unable to find a solution.

I have two divs. div3 must change its contents accordingly whenever div2 changes. Div2 is changed via ajax, thus when this happens it must trigger another ajax call to change div3 as well.

Here are the details:

  1. I have main.html, which contains several different clickable buttons. Onclick, each of these buttons will trigger an ajax function to load, which outputs a php file in div2.
  2. This php script outputs the results of a database query, which are different depending on which button in main.html was clicked.

  3. I have a div- div3, which is supposed to display the contents of a subsection of data of the current div 3 output.

  4. Thus it logically follows that whenever div2 changes, div3 contents must change accordingly.

  5. Initially i thought i could just put the function call to the second ajax function at the end of the php file, that way it would always load right after the php file, but apparently java cannot be read from within an ajax output.

Here’s what i’ve tried:

  1. Tried putting a function call in javascript <script> tags at the end of the php file, but didnt work for above mentioned reasons.
  2. I tried to call the function as an onload event of the last div of the php file, but it doesnt work.
  3. I tried to add onchange to the div2 element so that whenever the contents is changed via ajax the second ajax script runs, but it didnt work.
  4. I tried to call my second ajax function from the very end of the first ajax function, but that prevented my first function from working properly.
  5. Strangely enough, if i attach the function to an onclick event in the php file, and click on it from div2 when the php has loaded, it works, and updates div3 contents.

All i need to do is find a way to turn that onclick function call into something automatic whenever either the php page loads, or when div2 contents change.

Additional notes:
1. I’d like to stay away from eval if i can, because i tried to learn it but the methodology of developing an appropriate regex and all the other details seemed very complicated to me. It might take me hours to develop an appropriate approach and even then might not work….I’d prefer to stick with all the possible simple options i’ve overlooked or might not have implemented properly.
2. I’ll be watching this post like a hawk so if you need additional details feel free to request. I didnt post my code because it’s fairly lengthy and hard to encapsulate the nature of the problem in a more brief example.

Thanks!

  • 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-13T14:26:21+00:00Added an answer on June 13, 2026 at 2:26 pm

    If I understood you correctly, you can try something like this:

    $.ajax({
      type:'post',
      url:'url goes here',
      data:{<insert data being passed>},
      success:function(ret)
      {
          $('div y').html(ret); // populate div y
    
          $.ajax({
            type:'post',
            url:'second url goes here',
            data:{<insert data being passed>},
            success:function(ret2)
            {
             $('div x').html(ret2); // populate div x                
            }
          });    
      }
    });
    

    Of course this is a jquery approach of which I’m quite a big fan

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and

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.