Can anybody let me know what is wrong with this code?
this function will help to remove a particular data in mysql table. Data was successfully removed but the response from the jquery ajax function is not what I expected.
function removeMember(id,url){
var data = "action=removeMember&id="+id;
var action = ajaxReturnData('POST',data,url);
if(action == '1'){
$(".msg").html("done");
$("#span_delete_"+id).parent().parent().empty().hide("slow");
}else if(action.response == '0'){
$(".msg").html("failed");
}
}
/*User defined functions */
function ajaxReturnData(method,data,url){
$.ajax({
url: url,
data: data,
type: method,
success: function(data) {
return data;
},
error : function(jqXHR, exception){
return '0';
}
});
}