$(function () { $('#redisImport').click(function () { var contentHtml = '

Commands Import

' + '
' + '
' + '
' + '
' $('#frame').html(contentHtml) var importCodeMirror = CodeMirror.fromTextArea(document.getElementById('importCommands'), { lineNumbers: true, matchBrackets: true, height: 500 }) $('#redisImportBtn').click(function () { var commands = importCodeMirror.getValue() $.ajax({ type: 'GET', url: contextPath + "/redisImport", data: {server: $('#servers').val(), database: $('#databases').val(), commands: commands}, success: function (content, textStatus, request) { $('#importResult').html('
' + content + '
') }, error: function (jqXHR, textStatus, errorThrown) { alert("2." + jqXHR.responseText + "\nStatus: " + textStatus + "\nError: " + errorThrown) } }) }) }) })