I search for a solution, and there are some answers but none solve my problem. I want to add variable to the end of url which is user text input value (this is number of ID to delete in database).
var idRem = parseInt($('#removeId').val(),10);
$removeBtn.on('click',function(){
$.ajax({
type: 'DELETE',
url: "http://rest.learncode.academy/api/kuba/friends/"+idRem,
success: function() {
//no data...just a success (200) status code
console.log('Friend Deleted Successfully!');
},
error: function() {
alert('Deleting error');
}
});
});
I see only error message, but when I put manually the value to the url or assign to variable then it works.
Is there anyone knows what is wrong?