我对 jquery 和 js 很陌生,但在 myphp.php 文件中有这段代码:
<?php
echo "<div><tr><a href='javascript:getspreadsheets();'>Cape Culture (10 years)</a></tr><br />";
echo "<tr><a href='javascript:getspreadsheets();'>Winsters (5 Years)</a></tr><br />";
echo "<tr><a href='javascript:getspreadsheets();'>Kayo (1 year)</a></tr><br />";
echo "<tr><a href='javascript:getspreadsheets(1498);'>Col Timbers</a></tr></div>";
?>
<script type="text/javascript">
function getspreadsheets(val)
{
alert(val);
var self = this,
activityguid = self.activityguid,
accountguid = self.accountguid
$.fileDownload(
'data/export.items_to_csv.php',
{
httpMethod: 'POST',
data: {
activityguid : activityguid,
accountguid : accountguid,
classid : val
}
});
alert(val);
//}
}
</script>
当我运行它时,我收到第一个警报,但随后收到一条错误消息,指出 $ 未定义?有人可以帮忙吗?谢谢