X
X
xlo2402019-09-16 18:27:26
Node.js
xlo240, 2019-09-16 18:27:26

How to write a simple ajax request in nodejs?

How to write a simple ajax request in nodejs?

It is necessary that ajax accesses a certain remote url ( site.ru/ajax.php ), transmits data and returns a certain value

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eduard Shkuta, 2019-09-16
@dyus1

Axios is here to help.

D
Dmitry Belyaev, 2019-09-16
@bingo347

Low level api: https://nodejs.org/dist/latest-v12.x/docs/api/http...
fetch (like in browser): https://www.npmjs.com/package/node-fetch
axios already suggested above, but in my opinion its only + in versatility (what fetch does better with, as for me), but from the minuses it is heavy, retarded ...
And finally, request is a very good abstraction over the low-level api of the node - https:/ /www.npmjs.com/package/request - cons - no promises out of the box

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question