Different Url Has To Be Passed For Same Ajax Call
I am doing add and edit operation. To perform edit operation I have used the below link for reference and finished it. If I click the edit button I can see popup form with detai
Solution 1:
By Making the common function for the Ajax:
functiondoAjaxCall(var url,var data,var method,var callBackFunction)
{
$.ajax({
type: method,
url: url,
data: data,
success: function(data){
callBackFunction(data);
}
});
}
Call the Function like this
functiononAdd(data){
// Code to append
}
doAjaxCall("/add",userData,"POST",onAdd);
functiononEdit(data){
// Code to update
}
doAjaxCall("/update",userData,"PUT",onEdit);
Post a Comment for "Different Url Has To Be Passed For Same Ajax Call"