I am using $.ajax
for Facebook Invite and calling the URL (Yii framework controller). The $.ajax
part of the below code is not working:
function FacebookInviteFriends()
{
FB.ui
(
{
method : 'apprequests',
data: '',
display: 'dialog',
title : 'Invite a Friend',
message: 'I just sent you an invitation to play My Game.',
filters: ['app_non_users']
}, function(response)
{
alert("start");
if (response && response.to)
{
alert("inside if");
$.ajax({
url: 'http://localhost:83/invitechips/createRecord',
type: 'POST',
data: {id : response.to}
}).done(function() {
alert( "Data Saved: ");
});
}
else
{
alert("inside else");
}
}
);
}
In your ajax call where you have things like url and type, you need to add something to handle errors, like :
error: function(xhr, status, error) {
// perform operations on error
alert(xhr.responseText);
},
so you would have
$.ajax({
url: 'http://localhost:83/invitechips/createRecord',
type: 'POST',
error: function(xhr, status, error) {
// perform operations on error
alert(xhr.responseText);
},
data: {id : response.to}
}).done(function() {
alert( "Data Saved: ");
});
so that you can get more details. Do you have this code hosted somewhere?