Parse HTML, fetch html element


(Saša Fišter) #1

I use axios for API request to some url, and I get back string of whole website. Now I want to fetch specific dom element, i.e.

20
to use this data for comparing prices. How can I parse that data to get only integer?

(Arthur Park) #2

Try reading the api doc and find out If the api supports JSON/XML response. It will be much easier to grab value you want. Otherwise(If it only returnes raw html), you’ll have to parse html and grab the value you want unless api supports returning a single element.


(Saša Fišter) #3

I did it with jQuery


(Jakob Lind) #4

If you are using jQuery also for your ajax call you could try something like was suggested in this stack overflow question.