I have a node server that is running on different port "81", i want to get the response for the Ajax GET call then check the response if it has some kind value return true for accept
attribute for droppable
callback function.
This is the code i have:
$(document).ready(function(){
$('.user').draggable();
$('.user').droppable({
accept: function() {
$.ajax("http://127.0.0.1:81/").done(function(data){
if(data.toString() == "success")
return true;
else
return false
});
},
activeClass: 'ui-state-hover',
hoverClass: 'ui-state-active'
drop: function(event, ui){
$(this).addClass("ui-state-highlight").find("b").html("User deleted.");
}
});
});
});
And how can i get the response from data.
Note: In the Node.js server i'm returning a text with res.end("success");
.