<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/themes/cupertino/jquery-ui.css"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#stock").autocomplete({
source: function (request, response) {
// faking the presence of the YAHOO library bc the callback will only work with
// "callback=YAHOO.Finance.SymbolSuggest.ssCallback"
var YAHOO = window.YAHOO = { Finance: { SymbolSuggest: {} } };
YAHOO.Finance.SymbolSuggest.ssCallback = function (data) {
var mapped = $.map(data.ResultSet.Result, function (e, i) {
return {
label: e.symbol + ' (' + e.name + ')',
value: e.symbol
};
});
response(mapped);
};
var url = [
"http://d.yimg.com/autoc.finance.yahoo.com/autoc?",
"query=" + request.term,
"&callback=YAHOO.Finance.SymbolSuggest.ssCallback"];
$.getScript(url.join(""));
},
minLength: 2
});
});
</script>
<meta charset="utf-8" />
</head>
<body>
Stock Symbol
<input id="stock" type="text" placeholder="type to search stocks" />
</body>
</html>
<html>
<head>
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/themes/cupertino/jquery-ui.css"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#stock").autocomplete({
source: function (request, response) {
// faking the presence of the YAHOO library bc the callback will only work with
// "callback=YAHOO.Finance.SymbolSuggest.ssCallback"
var YAHOO = window.YAHOO = { Finance: { SymbolSuggest: {} } };
YAHOO.Finance.SymbolSuggest.ssCallback = function (data) {
var mapped = $.map(data.ResultSet.Result, function (e, i) {
return {
label: e.symbol + ' (' + e.name + ')',
value: e.symbol
};
});
response(mapped);
};
var url = [
"http://d.yimg.com/autoc.finance.yahoo.com/autoc?",
"query=" + request.term,
"&callback=YAHOO.Finance.SymbolSuggest.ssCallback"];
$.getScript(url.join(""));
},
minLength: 2
});
});
</script>
<meta charset="utf-8" />
</head>
<body>
Stock Symbol
<input id="stock" type="text" placeholder="type to search stocks" />
</body>
</html>