Need help in code - Accessing Google stock price using JavaScript

hi,
i am trying to get current price of google stocks by using javascript, but not able to do this .i would really appreciate if you could help me out in this… the JS code is given below -

var currentPrice;
$(document).ready(function()              
 {
$.getJSON("http://finance.google.com/finance/info?client=ig&q=NASDAQ%3AGOOG",function(data) 
  {    
  currentPrice= "Current Price for Google Stock is" + data.l ;
$("#test").html(currentPrice);
});
});

That is jQuery. Do you have a link to jQuery in your script somewhere?

Hey, thanks for your efforts.
are you asking about this link?

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

I have linked my HTML page to this -

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

  <body>
   
     <h2>Google Stock Price </h2>

<div class ="row text-center">
      <div class ="col-xs-12 " id="test">
       
        </div>
      </div>
    </body>

But is the JQuery file loaded in your page? You should have that library before your page can run the JQuery.

Yes, that’s the one.

You don’t show any <head> tags. It might help if we saw your complete page.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.