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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:02:24+00:00 2026-06-13T11:02:24+00:00

In my index.php page, I take sth from user and give response in a

  • 0

In my “index.php” page, I take sth from user and give response in a div using “ajax.php”. ajax page returns an ordered list divided into divs called pages. After ajax loaded, I need to execute a function which sets some css properties of the pages. The function is ready and works properly when I attached it to a button’s onClick event. But I want execute it automatically after the ajax page loaded. I tried:

  1. onload events also in index.php and ajax.php at the top of the page and also at the bottom of the page–> it doesn’t work
  2. function in function showAjax(){…setCSS();}–> I failed to run it after the whole ajax page loaded
  3. callback function–> it doesn’t work properly
  4. onClick event like that onClick=”showAjax(); setCSS();”–> it doesn’t work

I don’t use jQuery. I examined similar problems solving methods but they don’t work. I appreciate anyone saves me from this trouble. Thanks

Code Added:

var xmlHttp;

function loadXMLDoc(url,cfunc) {
    if (window.XMLHttpRequest) {
        xmlHttp=new XMLHttpRequest();
    } 
    else {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    } 
    xmlHttp.onreadystatechange=cfunc; 
    xmlHttp.open("GET",url,true); 
    xmlHttp.send();
}

function showAjax(x) { 
    loadXMLDoc("ajax.php?obj="+x,function() {
       if (xmlHttp.readyState==4 && xmlHttp.status==200) {
          document.getElementById("sonuclar").innerHTML=xmlHttp.responseText;
       }
    });
}
  • 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-13T11:02:25+00:00Added an answer on June 13, 2026 at 11:02 am

    I solved the problem. “if (xmlHttp.readyState==4 && xmlHttp.status==200)” this statement is already controlling if the ajax loaded completely. So I add my setCSS function into showAjax function as callback

    `function showAjax(x, func) {

    loadXMLDoc("ajax.php?obj="+x,function() {
    
       if (xmlHttp.readyState==4 && xmlHttp.status==200) {
    
          document.getElementById("sonuclar").innerHTML=xmlHttp.responseText;
    
          func();
    
       }
    
    });
    

    }

    onclick=showAjax(this.value, setCSS);’

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

Sidebar

Related Questions

Take a look at this page: http://jqeedu.tuxfamily.org/test/index.php . You'll see a < between the
I have a ajax function in index.php which calls on the page thread.php which
I have this page, let's call it index.php index.php has a list of users
On the index.php page of my site, I have a list of filter option
I have a index.php page that is the main page. All pages are included
I have my index.php page and just afrer my header i want to include
My PHP site has header,body,footer files that are included into the INDEX.PHP page. On
I have a function that I use on index.php page and I would like
i have a question, i have a index.php page that is the intro of
I have the following scenario. I have a index.php page with the following JQuery

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.