I do not need assistance in code but in designing the solution to my problem.
I designed an asynchronous function exactly as explained in the accepted answer to this question: How to make a function wait until a callback has been called using node.js .
I also call that asynchronous function as described there:
myFunction(query, function(returnValue) {
// Display returnValue and display it in a DIV called myDIV
});
My problem:
I have a webpage containing a header, a footer and 2 DIVs in between them.
Clicking on one of the DIVs leads to erasing (display:none
) them and calling to myFunction( ... )
above. But DIV (in above comment) does not show itself between the header and the footer of the page.
When I try this:
myFunction(query, function(returnValue) {
// creating a DIV as a documentElement to display returnValue within it
// document.body.append(myDIV)
});
I see myDIV
appended after the footer but not between the header and the footer of the page (in place of the 2 previous DIVs)
Can you please tell me how to tackle this problem?