【问题标题】:Load file Javascript on referer main page在referer主页上加载文件Javascript
【发布时间】:2020-03-26 04:52:29
【问题描述】:

我的脚本是这样的:

function showBrand(str) {
    if (str=="") {
        document.getElementById("txtHint").innerHTML="";
        return;
    }
    if (window.XMLHttpRequest) {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    } else { // code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function() {
        if (this.readyState==4 && this.status==200) {
          document.getElementById("txtHint").innerHTML=this.responseText;
        }
    }
    xmlhttp.open("GET","index?modul=sgob&q="+str,true);
    // xmlhttp.open("GET","window.location.href + "?q="+str,true);
    xmlhttp.send();
}

但文件 javascript 未引用文件 modul=sgob.. 所以我无法运行复选框全选。

【问题讨论】:

    标签: javascript php html ajax


    【解决方案1】:

    是的,我已经解决了这个问题,我终于在javascript中更改了我的代码,如下所示:

    jQuery(function() {
        $("#getBus").change(function() {
            var id = $(this).find(":selected").val();
            var dataString = 'action='+ id;
    
            $.ajax({
                url: "index?modul=sgob",
                data: dataString,
                cache: false,
                success: function(response) {
                    /* If Success */
                    $("#show-bus").html(response);
                }
            });
        });
    });
    

    然后 modul=sgob 可以运行 checkbox select all..

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-14
      相关资源
      最近更新 更多