site.js 799 B

123456789101112131415161718192021
  1. // Write your Javascript code.
  2. var sendDemoCode = function (btnElement, api) {
  3. //console.log(api);
  4. var resultPanel = $(btnElement).parent().siblings(".apiresult");
  5. var resultElement = $(resultPanel).find(" div > .search-result");
  6. $(resultPanel).show();
  7. $.get(api, function (data, status) {
  8. $(resultElement).html('');
  9. //$(resultElement).text(data);
  10. var editor = ace.edit($(resultElement)[0]);
  11. var session = editor.getSession();
  12. editor.setTheme("ace/theme/sqlserver");
  13. session.setMode("ace/mode/json");
  14. session.setValue(js_beautify(data));
  15. //$(resultElement).ace({ theme: 'twilight', lang: 'json' });
  16. //$(resultElement).text(js_beautify(data));
  17. //$(resultPanel).show();
  18. }, "text");
  19. };