The scope is private, so you have two options: a - change ajax method code, assigning the last jsonp call to a global object, e.g. jQuery ( jQuery.lastJSONP = jsonp = "jsonp" + jsc++; ) b - use a list of possible JSONP calls and compare the difference.
Last point could be something like: function jsonpList(){ var found = [], key; for(key in window) if(/^jsonp[0-9]+$/.test(key)) found.push(key); return found; }; function jsonpDiff(listBefore, listAfter){ if(2 < arguments.length) listAfter = arguments[2]; return listAfter.join("|").replace(new RegExp(listBefore.join("|"), "g"), "").replace(/\|+/g, "|").replace(/^\|+|\|+$/g, "").split("|") }; the first function returns a list of active/assigned jsonp calls, while the second one compare two lists and return a list with differences. A procedural example could be this one: var beforeCall = jsonpList(); // perform here your jsonp call via jQuery var afterCall = jsonpList(); var lastJSONPCallKey = jsonpDiff(beforeCall, afterCall)[0]; alert(window[lastJSONPCallKey]); // jsonp callback A more tricky way to obtain the key for a single element could be this one: var lastJSONPCallKey = jsonpDiff(jsonpList(), $.ajax(/*JSONP req info*/), jsonpList())[0]; Kind Regards. On Thu, Oct 2, 2008 at 3:17 AM, Jed Schmidt <[EMAIL PROTECTED]> wrote: > > Hello all, > > I'm wondering if anyone here knows of a reliable way of canceling a > $.getJSON request for cross-domain JSONP. > > For example, is there any way to figure out the name of the function > that jQuery appends to the window (such as "jsonp1222912605851"), so > that I can just replace it with function(){}, and prevent the original > callback from executing? > > Any help appreciated, > > Jed Schmidt > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---