-
-
Save utkarshkukreti/275465e017f5715659f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gsearch(term, callback) { | |
dump("START", term, callback) | |
var url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=" + term; | |
var req = new XMLHttpRequest; | |
dump("END", term, callback) | |
req.open('GET', url, true); | |
req.onreadystatechange = function (aEvt) { | |
if (req.readyState == 4) { | |
var reply = "Failed"; | |
if(req.status == 200) { | |
var json = JSON.parse(req.responseText); | |
if(json.responseData.results.length > 0) { | |
reply = json.responseData.results[0].url + " -> " + json.responseData.results[0].content; | |
} | |
} | |
callback(reply); | |
} | |
}; | |
req.send(null); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
STARTWARNING: NS_ENSURE_TRUE(wrapper) failed: file /home/utkarsh/dev/hg/instantbird/mozilla/dom/base/nsJSUtils.cpp, line 153 | |
nullnull[xpconnect wrapped (nsISupports, nsIClassInfo, imIConversation, purpleIConversation, nsIObserver, purpleIConvIM) @ 0xaef653e0 (native @ 0xaf1219e0)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment