1 function getJsonpCallback(url){
3 var idMatch = url.match(/jsonp=(.*?)(&|$)/);
7 //jsonp didn't match, so maybe it is the jsonCallback thing.
8 idMatch = url.match(/callback=(.*?)(&|$)/);
15 result = decodeURIComponent(result);
20 function findJsonpDone(){
22 var scriptUrls = getScriptUrls();
24 for(var i = 0; i < scriptUrls.length; i++){
25 var jsonp = getJsonpCallback(scriptUrls[i]);
27 eval(jsonp + "({animalType: 'mammal'});");
35 function getScriptUrls(){
36 //Get the script tags in the page to figure what state we are in.
37 var scripts = document.getElementsByTagName('script');
38 var scriptUrls = new Array();
39 for(var i = 0; scripts && i < scripts.length; i++){
40 var scriptTag = scripts[i];
41 if(scriptTag.id.indexOf("dojoIoScript") == 0){
42 scriptUrls.push(scriptTag.src);
49 function doJsonpCallback(){
51 alert('ERROR: Could not jsonp callback!');
55 //Set a timeout to do the callback check, since MSIE won't see the SCRIPT tag until
56 //we complete processing of this page.
57 setTimeout(function(){doJsonpCallback();}, 300);