frontmatter parsing better; edit not working

This commit is contained in:
Henrique Dias
2015-09-14 22:03:09 +01:00
parent 3b0d8380cb
commit 234e2a1ec4
7 changed files with 161 additions and 110 deletions

View File

@@ -4,11 +4,11 @@ $(document).ready(function() {
var url = $(this).attr('action')
$.ajax({
type : 'POST',
url : url,
data : data,
dataType : 'json',
encode : true,
type: 'POST',
url: url,
data: data,
dataType: 'json',
encode: true,
}).done(function(data) {
alert("it workss");
}).fail(function(data) {
@@ -17,24 +17,42 @@ $(document).ready(function() {
event.preventDefault();
});
$("#logout").click(function(e) {
e.preventDefault();
jQuery.ajax({
type: "GET",
url: "/admin",
async: false,
username: "logmeout",
password: "123456",
headers: {
"Authorization": "Basic xxx"
}
})
.fail(function() {
window.location = "/";
});
return false;
});
});
$.fn.serializeField = function() {
var result = {};
this.each(function() {
$(this).find("> *").each(function() {
var $this = $(this);
var name = $this.attr("name");
if ($this.is("fieldset") && name) {
result[name] = $this.serializeField();
}
else {
$.each($this.serializeArray(), function() {
result[this.name] = this.value;
});
}
});
$.fn.serializeField = function() {
var result = {};
this.each(function() {
$(this).find("> *").each(function() {
var $this = $(this);
var name = $this.attr("name");
if ($this.is("fieldset") && name) {
result[name] = $this.serializeField();
} else {
$.each($this.serializeArray(), function() {
result[this.name] = this.value;
});
}
});
return result;
};
});
return result;
};