- console.log(editor.getCode(), $('form input[name=text]').get(0));
- $('form textarea[name=text]').val(editor.getCode());
- $('form').ajaxSubmit(function() {
- alert('Udało się!');
- });
+ $.blockUI({message: $('#save-dialog')});
+
+ // console.log(editor.getCode(), $('form input[name=text]').get(0));
+ // $('form textarea[name=text]').val(editor.getCode());
+ // $('form').ajaxSubmit(function() {
+ // alert('Udało się!');
+ // });
+ });
+
+ $('#save-ok').click(function() {
+ $.blockUI({message: 'Zapisywanie...'});
+
+ var data = {
+ name: $('#document-name').html(),
+ text: editor.getCode(),
+ revision: $('#document-revision').html(),
+ author: 'annonymous',
+ comment: $('#komentarz').val()
+ };
+
+ console.log(data);
+
+ $.ajax({
+ url: document.location.href,
+ type: "POST",
+ dataType: "html",
+ data: data,
+ success: function() {
+ $.unblockUI();
+ },
+ error: function(xhr, textStatus, errorThrown) {
+ alert('error: ' + textStatus + ' ' + errorThrown);
+ },
+ })