{"record":{"id":"0d7b36af6432abf9","repo":"Semantic-Org/Semantic-UI","slug":"you-are-using-legacy-api-success-callback-names","errorCode":null,"errorMessage":"You are using legacy API success callback names","messagePattern":"You are using legacy API success callback names","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/definitions/behaviors/api.js","lineNumber":1131,"sourceCode":"\n  // failed JSON success test\n  onFailure   : function(response, $module) {},\n\n  // server error\n  onError     : function(errorMessage, $module) {},\n\n  // request aborted\n  onAbort     : function(errorMessage, $module) {},\n\n  successTest : false,\n\n  // errors\n  error : {\n    beforeSend        : 'The before send function has aborted the request',\n    error             : 'There was an error with your request',\n    exitConditions    : 'API Request Aborted. Exit conditions met',\n    JSONParse         : 'JSON could not be parsed during error handling',\n    legacyParameters  : 'You are using legacy API success callback names',\n    method            : 'The method you called is not defined',\n    missingAction     : 'API action used but no url was defined',\n    missingSerialize  : 'jquery-serialize-object is required to add form data to an existing data object',\n    missingURL        : 'No URL specified for api event',\n    noReturnedValue   : 'The beforeSend callback must return a settings object, beforeSend ignored.',\n    noStorage         : 'Caching responses locally requires session storage',\n    parseError        : 'There was an error parsing your request',\n    requiredParameter : 'Missing a required URL parameter: ',\n    statusMessage     : 'Server gave an error: ',\n    timeout           : 'Your request timed out'\n  },\n\n  regExp  : {\n    required : /\\{\\$*[A-z0-9]+\\}/g,\n    optional : /\\{\\/\\$*[A-z0-9]+\\}/g,\n  },\n\n  className: {","sourceCodeStart":1113,"sourceCodeEnd":1149,"githubUrl":"https://github.com/Semantic-Org/Semantic-UI/blob/597843ab84d565cccfd8fd7719416350ae73e734/src/definitions/behaviors/api.js#L1113-L1149","documentation":"This error is logged by the API module's get.settings() function (api.js:716-748) when the user's beforeSend callback returns a settings object that still uses the legacy callback names success, failure, or complete instead of the current onSuccess, onFailure, onComplete. The module detects these legacy properties, logs the error for each, and migrates them to the new names automatically. This is a deprecation warning, not a functional failure.","triggerScenarios":"Providing a beforeSend callback that returns an object with .success, .failure, or .complete properties instead of .onSuccess, .onFailure, or .onComplete. This commonly occurs when copying old jQuery $.ajax() configuration patterns into the API module's beforeSend.","commonSituations":"Migrating from an older version of Semantic UI or Fomantic-UI that used legacy callback names. Developers familiar with jQuery's native $.ajax success/error/complete API using those names in the API module's settings. Copy-pasting AJAX code samples from jQuery tutorials.","solutions":["Rename success to onSuccess, failure to onFailure, and complete to onComplete in the settings returned by beforeSend.","Move callbacks to the top-level settings object instead of returning them from beforeSend."],"exampleFix":"// before\n$('.api-element').api({\n  beforeSend: function(settings) {\n    settings.success = function(response) { /* ... */ };\n    settings.failure = function(response) { /* ... */ };\n    return settings;\n  }\n});\n\n// after\n$('.api-element').api({\n  beforeSend: function(settings) {\n    settings.onSuccess = function(response) { /* ... */ };\n    settings.onFailure = function(response) { /* ... */ };\n    return settings;\n  }\n});","handlingStrategy":"validation","validationCode":"// Validate beforeSend return object for legacy property names\n$('.el').api({\n  beforeSend: function(settings) {\n    // Check for and migrate legacy callback names\n    if (settings.success) { settings.onSuccess = settings.success; delete settings.success; }\n    if (settings.failure) { settings.onFailure = settings.failure; delete settings.failure; }\n    if (settings.complete) { settings.onComplete = settings.complete; delete settings.complete; }\n    return settings;\n  }\n});","typeGuard":"// Type guard: check for legacy callback names\nfunction hasLegacyCallbacks(settings) {\n  return settings && (settings.success !== undefined || settings.failure !== undefined || settings.complete !== undefined);\n}","tryCatchPattern":null,"preventionTips":["Use the current callback names: onSuccess, onFailure, onComplete.","Run a codebase search for .success, .failure, .complete in API module configuration to find legacy patterns.","Avoid copying jQuery $.ajax() configuration patterns directly into the API module."],"tags":["api","deprecation","legacy","callbacks","semantic-ui"],"backgroundTag":null,"analyzedSha":"597843ab84d565cccfd8fd7719416350ae73e734","analyzedAt":"2026-08-13T01:44:23.827Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}