Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Autocomplete and Yahoo Finance
    primarykey
    data
    text
    <p>I'm trying to make jQuery Autocomplete, Yahoo Finance and Zend Framework work together.</p> <p>What I want is to create a form field in which I can autocomplete tickers symbols through Yahoo API.</p> <p>I've already created a Zend_From element that contains this :</p> <pre><code> $this-&gt;setJQueryParam('source', new Zend_Json_Expr('function( request, response ) { $.ajax({ type: "GET", dataType: "jsonp", jsonp: "callback", jsonpCallback: "YAHOO.Finance.SymbolSuggest.ssCallback", data: { query: request.term }, cache: true, url: "http://autoc.finance.yahoo.com/autoc"; } }); }')); $this-&gt;getView()-&gt;jQuery()-&gt;addJavascript('var YAHOO={Finance:{SymbolSuggest:{}}};'); $this-&gt;getView()-&gt;jQuery()-&gt;addOnLoad('YAHOO.Finance.SymbolSuggest.ssCallback = function (data) { console.log(JSON.stringify(data)); }'); </code></pre> <p>I found <a href="https://stackoverflow.com/questions/6567119/yahoo-jsonp-ajax-request-wrapped-in-callback-function">this post</a> that resolved a part of my problem, but I think using <code>var YAHOO={Finance:{SymbolSuggest:{}}};</code> is a dirty trick and isn't the right way to do. </p> <p>Now, if I type GOO in my field, then the firebug console will show me something like this:</p> <blockquote> <p>{"ResultSet":{"Query":"goo","Result":[{"symbol":"GOOG","name":"Google Inc.","exch":"NMS","type":"S","exchDisp":"NASDAQ","typeDisp":"Equity"},{"symbol":"GT","name":"Goodyear Tire &amp; Rubber Co.","exch":"NYQ","type":"S","exchDisp":"NYSE","typeDisp":"Equity"}...</p> </blockquote> <p>which is great, but I don't know how to send back these data to Autocomplete from this callback function, any idea?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload