0

I am trying to get Yahoo stock quote in the following way. but it does not work, can anyone tell where is wrong. Thanks!

<html>
<head>
   <script type="text/javascript" src="jquery-1.3.2.js"></script>
   <script type="text/javascript" language="JavaScript">

    $(document).ready(function(){
            $("#btn").click(function(event){
              alert(document.forms[0].ticker.value);
              $("#stockPrice").load("http://finance.yahoo.com/q?s=ibm #yfs_l10_ibm").text(); 
     });
 });

    </script>
<body>


<form name="myForm">
Ticker: <input type="text" name="ticker" id="ticker"/>
<input type="button" id="btn" value="get quote"/>
</form>

</body>
</head>
</html>

I changed from

$("#stockPrice").load("http://finance.yahoo.com/q?s=ibm #yfs_l10_ibm).text()

to

$("#stockPrice").load("ibm.dat"),text()

and copied the data to ibm.dat But I still have the following problem.

Message: Unexpected call to method or property access.
Line: 255
Char: 5
Code: 0
URI: file:///C:/Javascripts/jQuery/jquery-1.3.2.js

any idea?

Bill the Lizard
  • 386,424
  • 207
  • 554
  • 861
Southsouth
  • 2,561
  • 6
  • 30
  • 39

1 Answers1

6

assuming you meant it doesnt work. thats probably because you are trying to do cross domain ajax request which is prohibited. see http://www.ajax-cross-domain.com/

Funky Dude
  • 3,707
  • 2
  • 21
  • 32
  • 1
    In addition, if you want it to work, create a php/asp page that uses "Curl" to fetch the information you want and retrieve it via $.ajax or other method in jQuery. – yoda Nov 14 '09 at 22:56