JQuery在Firefox中不起作用,但在Chrome中起作用 [英] JQuery does not work in Firefox but works in Chrome
本文介绍了JQuery在Firefox中不起作用,但在Chrome中起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Chrome中,一切正常,但是不知何故,Firefox并没有看到jQuery。
$ b
这就是我如何调用jQuery
<! - Favicon和触摸图标 - >
< link rel =快捷图标href =assets / ico / favicon.png>
< script src =https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js>< / script> ;
< link rel =stylesheethref =http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css>
< script type =text / javascriptsrc =assets / bootstrap / js / datepicker.js>< / script>
这是失败的地方(错误是:ReferenceError:$未定义):
< script>
函数ajax_check(){
var id = $(#xml_select)。val(); //这是我得到的错误
$ b $ .ajax({
url:ajax_check.php?id =+ id,
success:function(response) {
var result = jQuery.parseJSON(response);
//console.log(JSON.stringify(result ['ncp']。replace('' '')));
var ncp = JSON.stringify(result ['ncp']);
var id = JSON.stringify(result ['id']);
$ b $(#racun)。val(ncp.substring(1,12));
$(#id_podnosilac)。val(id。子字符串(1,5));
},
});
}
< / script>
请帮忙,这可能是什么原因造成的?
解决方案A.狼发现的解决方案
当我把几个完整的请求(ctrl + f5)作为 A.狼时,Firefox开始工作正常建议。I'm having trouble with jQuery and Mozzila Firefox. Everything is working just fine in Chrome, but somehow Firefox does not see jQuery.
This is how I call jQuery
<!-- Favicon and touch icons --> <link rel="shortcut icon" href="assets/ico/favicon.png"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script type="text/javascript" src="assets/bootstrap/js/datepicker.js"></script>
And this is where it fails (error is: ReferenceError: $ is not defined):
<script> function ajax_check(){ var id = $("#xml_select").val(); // this is the line where I get error $.ajax({ url: "ajax_check.php?id="+id, success: function(response) { var result = jQuery.parseJSON(response); //console.log( JSON.stringify(result['ncp'].replace('"','')) ); var ncp = JSON.stringify(result['ncp']); var id = JSON.stringify(result['id']); $("#racun").val(ncp.substring(1,12)); $("#id_podnosilac").val(id.substring(1,5)); }, }); } </script>
Please help, what could be causing this?
解决方案Solution found by A.Wolf
Firefox started to work fine when i made couple of full requests(ctrl+f5) as A.Wolf suggested.
这篇关于JQuery在Firefox中不起作用,但在Chrome中起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文