Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/445.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从不在firefox上工作的Java脚本返回多个值(在IE上工作正常)_Javascript_Jquery - Fatal编程技术网

Javascript 从不在firefox上工作的Java脚本返回多个值(在IE上工作正常)

Javascript 从不在firefox上工作的Java脚本返回多个值(在IE上工作正常),javascript,jquery,Javascript,Jquery,我有一个主js文件(比如名称:my-dataTables.js)并从视图(groovy)访问它,该视图从my-dataTables.js调用函数 proto.dataTable = { 'filterOptions': function( selectedFilter ) { var dCodes = "" ; var dCodes2 = ""; if ( selectedFilter == 'test1' )

我有一个主js文件(比如名称:my-dataTables.js)并从视图(groovy)访问它,该视图从my-dataTables.js调用函数

proto.dataTable = {
    'filterOptions': function( selectedFilter ) {

        var dCodes = "" ;
        var dCodes2 = "";  

        if ( selectedFilter == 'test1'  ) 
        {
            dCodes = "something 1";
            dCodes2 = "something 2";
        }
        else 
        {
            dCodes = "something 2";
            dCodes2 = "something 1";
        }

        return {
        'dCodes': dCodes,
        'dCodes2': dCodes2
        };  
 }
并从视图(groovy)访问它们:


在IE上工作正常,意味着在IE上调用了“proto.dataTable.filterOptions”并返回了预期值。但在Firefox上,它似乎达到了$(“#filter status”).change(函数()但不在proto.dataTable.filterOptions()内)。没有错误消息。不确定我缺少了什么。有人能帮忙吗?

代码很好。这是浏览器缓存问题。我清理了缓存,代码按预期工作。

您确定在某个时候没有在
返回
{
之间引入换行符吗?“工作正常”没有很好的定义…你在Firefox中看到任何错误消息吗?它们说什么?你使用Firebug或任何其他JS调试工具吗?“工作正常”意味着调用了“proto.dataTable.filterOptions”,并从IE返回了预期值。但是在Firefox上,它看起来达到了$('#filter status')。更改(函数()但不在proto.dataTable.filterOptions()内,也没有错误消息。@Drise-谢谢。我不知道如何接受以及为什么这很重要。现在我知道了。
$('#filter-status').change(function () {
    var filterOptions = proto.dataTable.filterOptions($(this).find('option:selected').text());

    var dCodes = filterOptions.dCodes;
    var dCodes2 = filterOptions.dCodes2;

    alert(dCodes + " isRegex : " + dCodes);
});