A
A
Afafks1231321321652020-04-25 14:37:35
JavaScript
Afafks123132132165, 2020-04-25 14:37:35

How to add the response received from the server to a div?

For example, I received a response from the server through ajax. But now I need to add it in divhow to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
shsv382, 2020-04-25
@Afafks123132132165

fetch('something from server')
.then(response => response.json())
.then(data => {
let div = document.querySelector('desired div') ;
div.append(data)
})

A
anikavoi, 2020-04-25
@anikavoi

Well, if xs and lol, then "gee, go to Google, bro."
Honestly, use the search engine. The question is banal, there are a lot of answers to it.
PS: Sorry, it's boiling...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question