vbauer / manet

Website screenshot service powered by Node.js, SlimerJS and PhantomJS
MIT License
576 stars 102 forks source link

error after AJAX call #77

Closed l2ysho closed 3 months ago

l2ysho commented 7 years ago

I have problem with AJAX calls on manet running on local host. With curl or browser is everything ok.

This is my AJAX call:

 $.ajax({
        method: 'GET',
        url: 'http://localhost:8891/?url=github.com',
        contentType: 'application/json',
        dataType: 'jsonp',
        crossDomain: true,
    }).done(function (res) {
            console.log(res);
            var pdf = res;
    }).fail(function (error) {
        console.log(error.error);
    }) ;

When perform call, i get this error in console:

2017-02-02T11:44:24.727Z - info: Capture site screenshot: "github.com"

events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND jquery220038298134896883895_1486035861301 jquery220038298134896883895_1486035861301:80
    at errnoException (dns.js:26:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)

this is error from browser:

 Uncaught  SyntaxError: Unexpected token : ?url=github.com&callback=jQuery2200382…_1486035861301&_=1486035861302:1
vbauer commented 7 years ago

@l2ysho I think, you need try to use "POST" method with "application/json" parameter: https://github.com/vbauer/manet#rest-api