I'm getting 403 errors (forbidden) when attempting to submit a js AJAX call to the API. Anyone know what I'm doing wrong?
Anyone have a working AJAX template to use a sample?
Cheers
I'm getting 403 errors (forbidden) when attempting to submit a js AJAX call to the API. Anyone know what I'm doing wrong?
Anyone have a working AJAX template to use a sample?
Cheers
I thought I had to jsonp but I just had to json - jsonp gave 404 - seems to be working now! On a web server, calling RegisterPlayFabUser
For anyone reading this, I got it working and want to share this as a template for others (may be syntax errs -- I tried to replace some vals to make it easier to read rather than just pasting mine):
var json =
{
"TitleId": "xxxx",
//"Username": "test_user",
"Email": $( '#emailField' ).val(),
"Password": $( '#passField' ).val()
};
$.ajax({
type: "POST",
url: "https://xxxx.playfabiapi.com/Client/RegisterPlayFabUser,
data: JSON.stringify(json),
contentType: 'application/json',
dataType: 'json',
timeout: 5000,
headers:
{
//'X-authentication' : Session_Token_From_Valid_Session
},
cache: false,
success: function (data)
{
if (data) {
// Success!
}
else
{
// Fail! No reg data
}
},
error: function (xhr, status, errThrown)
{
var errCode = xhr.status;
console.log("**ERR: POST returned err for: RegisterPlayFabUser:");
console.log("**" + JSON.stringify(xhr));
if (errCode == 400)
{
console.log("**PlayFab callback err is due to bad parameters: Showing fail SWAL..");
swal('Registration Failed', 'Temporary Site Maintenance', 'error');
}
}
});
No one has followed this question yet.