Skip to content
Snippets Groups Projects
Commit fbc3a95a authored by colemanw's avatar colemanw
Browse files

Restore context to CRM.api CRM-12029

parent b66d5933
No related branches found
No related tags found
No related merge requests found
......@@ -82,7 +82,6 @@
return fieldName;
}
var checkable = function () {
$(this).change (function() {
var params={sequential:1};
......
......@@ -141,23 +141,23 @@ var CRM = CRM || {};
params.json = 1;
}
// Pass copy of settings into closure to preserve its value during multiple requests
(function(stg) {
(function(stg, that) {
$.ajax({
url: stg.ajaxURL.indexOf('http') === 0 ? stg.ajaxURL : CRM.url(stg.ajaxURL),
dataType: 'json',
data: params,
type: action.indexOf('get') < 0 ? 'POST' : 'GET',
success: function(result) {
stg.callBack.call(this, result, stg);
stg.callBack.call(that, result, stg);
}
});
})($.extend({}, settings));
})($.extend({}, settings), this);
};
// Backwards compatible with jQuery fn
$.fn.crmAPI = function(entity, action, params, options) {
console && console.log && console.log('Calling crmAPI from jQuery is deprecated. Please use CRM.api() instead.');
return CRM.api(entity, action, params, options);
return CRM.api.call(this, entity, action, params, options);
};
$.fn.crmAutocomplete = function (params, options) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment