使用Filepicker.io的Ymacs,使用ajax检索内容

时间:2012-07-11 17:20:08

标签: jquery ajax emacs conflict filepicker.io

我正在使用来自here的Filepicker.io的Ymacs,我正在尝试使用ajax检索内容div。

但问题是我不能包含jQuery库因为它导致了冲突并且ajax仍然无法工作我也尝试了来自jQuery的这个代码,但它似乎没有影响任何东西。

我把no noConflict放在两个地方。

任何想法如何解决这个问题?

<script type="text/javascript" src="/js/jquery-1.7.2.min.js">
     $.noConflict();

    window.setInterval(getAjax, 3000);

    function getAjax() {
        $.ajax({
            type: "POST",
            url: '/index',
            data: "some-data"          
        });
    }

</script>

1 个答案:

答案 0 :(得分:1)

您是否忘记了脚本标记,或者我错过了jQuery正在其他地方加载?这对我有用:

<!DOCTYPE html>
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script>
  // $.noConflict();

  window.setInterval(getAjax, 3000);

  // This is getting hoisted
  function getAjax() {
        $.ajax({
            type: "POST",
            url: '/index',
            data: "some-data"
        });
  }
</script>

https://gist.github.com/3505792