s.success is not a function

Submitted by Gold on Wed, 05/20/2009 - 22:31

This post is about JavaScript, jQuery and annoying errors that don't seem to have a solution out there. Right, keywords done. Here's the problem and the solution I used;

I was having an issue with a jQuery call that was returning the following error;

s.success is not a function

The code that was generating this was the callback function on the successful return from a getJSON() call. This is the original script;

call = '/admin/ts2/pending/approve/'+sid+'/'+c1+'/'+c2+'/'+c3;
$.getJSON(call, '', 'process_approved');

After a decent amount of hunting I drew a blank. There's a reasonable number of queries about this but no answer that I could use. One was a patch on the original jQuery source but given I'm working in a framework I'm not able to touch that.

I eventually figured out a work around though. Instead of using a callback function I used an in-line function and from that called my external function. This is the code as it stands now;

call = '/admin/ts2/pending/approve/'+sid+'/'+c1+'/'+c2+'/'+c3;
$.getJSON(call, '', function(data)

Hopefully this will be of use to someone.