当我调用下面的代码片段时,我得到的是空白内容,而不是保存在代码片段中的代码。有人能告诉我我错过了什么吗?如果我用"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>发布于 2014-04-15 07:39:32
只需转义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>https://stackoverflow.com/questions/23071874
复制相似问题