function runFunctionIfAvailable(callback, params) {
try {
if (typeof callback !== 'undefined') {
if ($.isFunction(callback)) {
if (params !== null) {
return callback(params);
} else {
return callback();
}
} else if (typeof callback === 'string') {
var f = new Function(callback);
if (params !== null) {
return f.call(params, params);
} else {
return f();
}
}
}
} catch (e) {
return false;
}
};
login.SubmitJsonpForm = function (form, onSuccessCallback, onBeginCallback, onErrorCallback, onCompleteCallback) {
var result = runFunctionIfAvailable(onBeginCallback);
if (result !== false) {
var url = form.attr("action");
if (url.indexOf('?') === -1) {
url = url + "?jsoncallback=?";
} else {
url = url + "&jsoncallback=?";
}
var formItems = form.serializeArray();
var added = [];
$.each(formItems, function () {
if ($.inArray(this.name, added) === -1) {
added.push(this.name);
$.cookie("__jsonpform_" + this.name, this.value, { secure: true, path: '/' });
}
});
try {
$.getJSON(
url,
function (data) {
runFunctionIfAvailable(onSuccessCallback, data);
})
.error(function () {
runFunctionIfAvailable(onErrorCallback, null);
})
.complete(function () {
clearCookies(added);
runFunctionIfAvailable(onCompleteCallback, null);
});
} catch (e) {
if (added) {
clearCookies(added);
runFunctionIfAvailable(onErrorCallback, null);
}
}
} else {
runFunctionIfAvailable(onCompleteCallback, null);
}
};
I am Getting the Following URL:
http://localhost/home/login?jsoncallback=?
Its working well in after hosting in server but in local system the action was not firing . the functionality is not working
please tell me the problem and how to run it on local.