4
4
4eloBek2018-05-31 09:53:28
Node.js
4eloBek, 2018-05-31 09:53:28

How to get data from ajax request?

Good afternoon. I'm trying to pull data from this address. Issues a TemporaryRedirect . Although in the browser everything looks fine. What's wrong? Tell me, please)

Attempt number one

var needle = require('needle');
var URL = 'https://vprognoze.ru/engine/modules/fc_resultat_ajax.php?ajax=1';
needle.get(URL, function(err, res){
    if (err) throw err;
  console.log(res.body) //TemporaryRedirect
});

Attempt number two
var request = require('ajax-request');
var URL = 'https://vprognoze.ru/engine/modules/fc_resultat_ajax.php?ajax=1';
request(URL, function(err, res, body) {
  console.log(body) //TemporaryRedirect
});

Thanks in advance)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arman, 2018-05-31
@4eloBek

follow a redirect? as I understand if there are no cookies, then there is a redirect.
https://github.com/tomas/needle#request-options
by default follow_max: 0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question