1

When I call the snippet below I get blank content instead of the code saved in the snippet. Can someone please tell me what I'm missing? If I replace the code with a string like "foobar" the string displays when I call the snippet. So it seems I'm missing something.

<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

1 Answer 1

1

Just escape your jquery call

<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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.