Sublime Text 2 Snippet返回空白

时间:2014-04-14 23:01:42

标签: sublimetext2

当我调用下面的代码段时,我会得到空白内容而不是代码段中保存的代码。有人可以告诉我我错过了什么吗?如果我用#34; foobar"等字符串替换代码。我调用代码段时会显示字符串。所以我似乎错过了一些东西。

<snippet>
    <content>
<![CDATA[

$.ajax({
  url: '/path/to/file',
  type: 'POST',
  dataType: 'xml/html/script/json/jsonp',
  data: {param1: 'value1'},
  complete: function(xhr, textStatus) {
    //called when complete
  },
  success: function(data, textStatus, xhr) {
    //called when successful
  },
  error: function(xhr, textStatus, errorThrown) {
    //called when there is an error
  }
});

]]>
</content>
<tabTrigger>ajax</tabTrigger>
</snippet>

1 个答案:

答案 0 :(得分:1)

逃避你的jquery电话

<snippet>
    <content>
<![CDATA[

\$.ajax({
  url: '/path/to/file',
  type: 'POST',
  dataType: 'xml/html/script/json/jsonp',
  data: {param1: 'value1'},
  complete: function(xhr, textStatus) {
    //called when complete
  },
  success: function(data, textStatus, xhr) {
    //called when successful
  },
  error: function(xhr, textStatus, errorThrown) {
    //called when there is an error
  }
});

]]>
</content>
<tabTrigger>ajax</tabTrigger>
</snippet>