Postingan lainnya
Saya kan mau membuat snippet di sublim, bagaimana ya caranya yang benar?
Saya mau menambahkan kode Ajax biar dpt dipanggil dg mudah.. spt ini:
<snippet>
<content><![CDATA[
function namafunction(){
var namavar = $("#event").val();
$.ajax({
type:"POST",
url: "<?php echo BASE_URL?>",
data: "data="+namavar,
dataType : "html",
success:function(msg){
$("#div_id_html").html(msg);
},
error:function(){
alert("Search failed");
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>Ajax</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
</snippet>
Saat aku gunakan kok gak bisa ya.. muncul peringatan spt ini:
Error parsing content for snippet, empty key ??
0
1 Jawaban:
itu ada beberapa yg kurang penutupnya gan, dan agan lupa escape tanda $. semestinya gini:
<snippet>
<content><![CDATA[
function namafunction(){
var namavar = \$("#event").val();
\$.ajax({
type:"POST",
url: "<?php echo BASE_URL?>",
data: "data="+namavar,
dataType : "html",
success:function(msg){
\$("#div_id_html").html(msg);
},
error:function() {
alert("Search failed");
}
});
}
]]></content>
<tabTrigger>ajax</tabTrigger>
<scope>source.js</scope>
</snippet>
0