I have created following function in webpart.ts
file to retrieve stock data from the Yahoo finance,
protected demo():void{
var symbol='goog';
var url = 'http://query.yahooapis.com/v1/public/yql?q=';
var data = 'select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20("'+symbol+'")&env=store://datatables.org/alltableswithkeys';
$.get(url+data, function(response ){
alert("Data: " + response );
});
}
By executing this url in browser it shows me data but with SharePoint workbench it gives me following error in console :
HelloWebArtWebPart.ts:77 Uncaught (in promise) TypeError: Cannot read property 'get' of undefined
at HelloWebArtWebPart.demo (HelloWebArtWebPart.ts:77)
at HelloWebArtWebPart.render (HelloWebArtWebPart.ts:69)
at HelloWebArtWebPart.e._renderWithAccessibleTitle (workbench-assembly_en-us_ba5b10d….js:133)
at workbench-assembly_en-us_ba5b10d….js:133
at <anonymous>
am i missing anything in this snippet?i have properly imported jquery.
import * as $ from 'jquery';
? assuming that you have installed jquery asnpm install jquery
import * as $ from 'jquery';
but now m gettin g new error in consoleMixed Content: The page at 'sites/dev/_layouts/15/workbench.aspx' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.financ…%20symbol%20in%20(%22goog%22)&env=store://datatables.org/alltableswithkeys'. This request has been blocked; the content must be served over HTTPS