Here is my code:
function OnSuccess(response) {
var tok = response.access_token;
alert(tok);
$.ajax({
type: "POST",
url: "https://webservice.com/apps/purchases/mass_create",
data: '{ utoken:' + tok + ',
platform: "general",
email:"test@gmail.com"
}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(response) {
alert("Success 2");
},
failure: function(response) {
alert("failure 2");
}
});
}
When I run this,while commenting out the entire $.ajax section, I get an alert with the value of tok, but if I leave in the $.ajax, I get an Illegal Token (in Chrome) on the "data: '{ utoken:' + tok + '," line.
What is my mistake?
Thanks