Mam dialog:
onEdit: function(ev, elem) {
var $elem = $(elem);
$('#NoteDialog').remove();
return $('<div id="NoteDialog""></div>').dialog({
title: "Note Editor",
resizable: false,
modal: true,
height: "300",
width: "450",
position: { my: "left bottom", at: "right top", of: elem},
buttons: {
"Save": function() {
var txt = $('textarea', this).val();
// Put the editied note back into the data area of the element
// Very important that this step is included in custom callback implementations
$elem.data("note", txt);
$(this).dialog("close");
},
// "Delete": function() {
// $elem.trigger("remove");
// $(this).dialog("close");
// },
"Add Comment": function(e){
var content = $('textarea').val();
var user_name = $('#user-name').val();
var datetime_php = (function () {
var list = [];
$.ajax({
url: "/sticky/getCurrentDateTime",
type: "POST",
dataType : "JSON",
success: function(res) {
list = res;
}
});
return list;
})();
console.log(datetime_php );
$('.post-container').append('<div class="post" style="border-bottom: 1px solid black;margin-bottom: 10px; padding-bottom: 10px;"><p class="post-date">2014-11-15 10:40</p><p class="post-name">'+user_name+'</p><p class="post-content">'+content+'</p></div>');
},
Cancel: function() {
$(this).dialog("close");
}
},
open: function() {
//Get the note text and put it into the textarea for editing
$(this).css("overflow", "hidden");
var note = '';
var form = '<form style="border-bottom: 1px solid black; padding-bottom: 10px;"><input type="text"></input><input type="submit" value="Add" /></form>';
var content = '<div class="post-container" style="height: 60%; width:100%; overflow-y: scroll; padding-top: 15px;"><div class="post" style="border-bottom: 1px solid black;margin-bottom: 10px; padding-bottom: 10px;"><p class="post-date">2014-11-15 09:28</p><p class="post-name">Jan Kowalski</p><p class="post-content">zawartosc</p></div></div>';
var textarea = '<textarea style="width: 100%; overflow: hidden; resize: none;"></textarea>';
var name = '';
var html = $(form+content+textarea);
$(this).html(html);
html.val($elem.data("note"));
}
});
},
i kiedy probuje pobrac ajaxem date z phpa to js zwraca pusta tablice co robie nie tak ? Jakies pomysly?
PHP oczywiscie zwraca date.