codeigniter-external java脚本文件不工作? 在我看来文件:codeigniter-external java脚本文件不工作?
<script src="<?php echo base_url();?>js/getquestion.js" type="text/javascript"></script>
<a onclick="getQuestion()" style="width: 280px; height: 540px; padding-top: 3px;" class="btn btn-primary" id="HyperLink">Start</a>
getquestion.js:
function getquestion() {
$.get("http://localhost/n/saq/saq/index.php/quizs/getquestion", function (resp) {
if (resp != null) {
$("#question").html(resp);
$("#loading").html("");
}
})
}
当我点击开始按钮,没有显示任何东西,
但是当我浏览到网址http://localhost/n/saq/saq/index.php/quizs/getquestion
其工作。请帮我
检查您的onclick事件函数name..your函数名getquestion()和你使用像getQuestion()...变化THT第一.... – Mahesh
试加'alert('yay');''。$ .get ...'脚本之前。如果出现“yay”,那么问题出现在你的'.get'脚本中。如果连“yay”都没有出现,那么你可能错误了.js文件的'src' –