I'm trying to do a POST RESTful api call from a button on Javascript. The api call is cross domain, so that is a challenge. How do I make this call?
In ajax my call looks like: [I now know that you can't do cross-domain calls from ajax]:
$.ajax({
type: 'POST',
dataType: 'application/json',
accept: 'application/json',
async: false,
username: 'user',
password: 'name',
url: 'http://exterenal.website',
data: {
"name": "Marcus0.7",
"start": 500000,
"end": 1361640526000
},
success: function(){alert('DONE!');},
error:function(){alert('ERROR!')},
});
in python the call looks like:
r = requests.post('http://externenal.website' ,headers={'content-type': 'application/json'}, auth=auth, data=json.dumps(data))
Thanks