How can i use this function always but only extend the success: function.. to my seperate callback?
global.js
// one time written and will be uesd 100 times without re-write the same thing.
function useEveryWhere(url, par) {
$.ajax({
type: "POST",
dataType: "json",
url: url, //PHP call
data: par,
async: true,
success : function(msg) {}
});
}
anotherpage1.js
// Here i need the success: function with different task
ueEveryWhere(url, parameters);
anotherpage2.js
// Here i need the success: function with different task too not same as anotherpage1.js
ueEveryWhere(url, parameters);
How do i have that global.js success method in any other scripts too, where i have random task not all are same.
You can use the ajaxSucess function to specify a global sucess method, and change
useEveryWhereto accept a success function:anotherpage1.js
anotherpage2.js