Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on How to load two or more files in one AJAX call?
Post
How to load two or more files in one AJAX call?
+0
−1
In my browser's JavaScript console I can add to the <body>
element one file (index.html) with the following AJAX code:
const whereToLoad = document.querySelector("body");
const ajax = new XMLHttpRequest();
ajax.open("GET", "/index.html", false);
ajax.send();
whereToLoad.innerHTML += ajax.responseText;
I tried to change ajax.open
to load two files instead, but that failed:
ajax.open(
"GET",
"/index.html",
"image.svg",
false
);
1 comment thread