Reputation: 2695
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?
Upvotes: 0
Views: 1836
Reputation: 3967
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/
Upvotes: 6