I'm trying to call a function in Particle.io using ajax POST. It works when I plug in the URL and parameters into Postman.
Now when I'm trying to do the same in NodeJS, I get the error: No Transport. I've installed jQuery v2.1.4 and jsdom v3.1.2. What am I doing wrong in translating what I have on Postman into ajax?
$.ajax({
url: requestURL,
method: 'POST',
headers: {
'Authorization': 'Bearer <accesstoken',
'Content-Type': 'application/json'
},
data: {
'arg': 'on'
},
dataType: 'json',
//contentType: 'application/json',
success: function(){
console.log('success!');
},
error: function( jqXhr, textStatus, errorThrown ){
console.log(errorThrown);
}
});
Particle.io API reference: https://docs.particle.io/reference/api/
Your help is greatly appreciated!!