I am trying to make my first transaction and I am failing. I tried using private and public nodes. If I use : 

    var iota = new IOTA({
       'provider': ' https://nodes.thetangle.org:443'
    });
     
    var seed = 'AAA....';
    var address = 'xyz....';

     
    var messageToSend = {
        'name': 'Dominik',
        'message': 'My first message sent with IOTA.'
    }
    
    
    var messageStringified = JSON.stringify(messageToSend);
    
    var messageTrytes = iota.utils.toTrytes(messageStringified);
    
    var transfer = [{
        'address': address,
        'value': 0,
        'message': messageTrytes
    }];
    
    iota.api.sendTransfer(seed, 4, 18, transfer, function(e, bundle) {
        if (e) throw e;
        console.log("Successfully sent your transfer: ", bundle);
    });

I get 

    Error: Request Error: Couldn't get a response from nodes

if I connect to my private node instead

     var iota = new IOTA({
    'host': 'http://xx.xxx.xxx.x',
    'port': 14700
    
});

I am waiting forever. Any idea what am I doing wrong?