Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/380.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 引导模式JS Uncaught TypeError:未定义不是函数_Javascript_Jquery_Twitter Bootstrap_Bootstrap Modal - Fatal编程技术网

Javascript 引导模式JS Uncaught TypeError:未定义不是函数

Javascript 引导模式JS Uncaught TypeError:未定义不是函数,javascript,jquery,twitter-bootstrap,bootstrap-modal,Javascript,Jquery,Twitter Bootstrap,Bootstrap Modal,我尝试使用javascript调用一个模式,但在运行该代码时,我从控制台收到以下错误: Uncaught TypeError: undefined is not a function 我曾研究过类似的问题,但没有一个对我有效。我的标题如下所示: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="//cdnjs.

我尝试使用javascript调用一个模式,但在运行该代码时,我从控制台收到以下错误:

Uncaught TypeError: undefined is not a function
我曾研究过类似的问题,但没有一个对我有效。我的标题如下所示:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<div class="modal fade" id="edit" tabindex="-1" role="dialog" aria-labelledby="edit" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div id="slotedit"></div>

        </div>
    </div>
</div>
function getEdit(slotID) {
    var xmlhttp = jQuery.noConflict();
    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 (xmlhttp.readyState==4 && xmlhttp.status==200) {
            //Change table element
            document.getElementById("slotedit").innerHTML=xmlhttp.responseText;
            $('#edit').modal('show');
        }        
    }
    xmlhttp.open("POST","getEditData.php",true);
    xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlhttp.send("slotID=" + slotID);
}
这让我有点困惑,但是js脚本在标题中的顺序似乎没有改变任何东西,并且使用该方法在另一个模式上调用该模式也不起作用(表明AJAX是可以的)

谢谢


编辑:$(“#编辑”)。。。无法修复:(

我猜您在
(“#编辑”)之前缺少了
“$”


它应该是
$('#edit')。modal('show');

我猜您在
('#edit')
之前缺少了
'$'


它应该是
$('#edit').modal('show');

另外,既然您仍然在使用jQuery,为什么不使用jQuery的便利$.ajax方法
$.post

function getEdit(id) {
  $.post('getEditData.php', { slotID: id }, function(data) {
    $('#slotedit').html(data);
    $('#edit').modal('show');
  });
}

而且,老实说,为什么要担心IE5和IE6;IE6也有

,为什么不使用jQuery的便利$.ajax方法,
$.post
,因为您无论如何都在使用jQuery

function getEdit(id) {
  $.post('getEditData.php', { slotID: id }, function(data) {
    $('#slotedit').html(data);
    $('#edit').modal('show');
  });
}

而且,老实说,为什么要担心IE5和IE6;IE6已经

谢谢了——不幸的是,美元符号仍然会出错——不幸的是,美元符号仍然会出错