As you all see, I'm a big NOOB for javascript and jquery, but I have a question about ajax request.
Here is what I want to do, but I do not know how:
- I announced
content.append('<div id="box"><textarea>some content</textarea></div'); - Now I want to do that
text = $('textarea').value();jumps to the ajax request.
something like that:
$.ajax({
type: "POST",
url: "/localstorage/boxes",
data: text,
contentType: "application/json; charset=utf-8",
dataType: "json"
});
and then later I want this data to return to another function oldBox()in order to display it when the user clicks on this event
UPDATE
function saveNote(){
var theNote = $('div#note');
var textValue = $this.$('textarea').value();
var textData = JSON.stringify(textValue);
$.ajax ({
type:"POST",
url: "/localstorage/notes",
data: textData,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data) {
loadNote(data);
}
});
}
That's good, it fixed my mistakes, but when I try to find the localstorage / notes file empty, should it be empty?
source
share