The execution position of append cannot be adjusted, and the output result can be changed.

topic description

in the following code, without changing the execution position of $("body"). Append ("bbb");, the output is changed from "bbbaaa" to" aaabbb".

.

sources of topics and their own ideas

the title comes from: Xiyanghui
my own idea of solving the problem:

related codes

/ / displays as bbbaaa after execution. It is required to change the way this code is written (the function remains the same) so that the display result becomes aaabbb. However, the execution position of $("body"). Append ("bbb"); cannot be adjusted and must be placed at the end of the main function.
$(function () {

$.get( "test.php", function( data ) {
    $( "body" ).append( "aaa" );
});
$("body").append("bbb");

});

what result do you expect? What is the error message actually seen?

Apr.22,2021

method 1:

$.get( "test.php", function( data ) {
    const content = $("body").contents();
    $( "body" ).append( "aaa" ).append(content);
});
$("body").append("bbb");

method N.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb2b98-4713c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb2b98-4713c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?