function bookmark_save() {
var item = $(this).parent();
var data = {
url: item.find("#id_url").val(),
title: item.find("#id_title").val(),
tags: item.find("#id_tags").val(),
};
$.post("/save/?ajax", data, function (result) {
if (result != "failure") {
item.before($("li", result).get(0));
item.remove();
$("ul.bookmarks .edit").click(bookmark_edit);
}
else {
alert("Failed to validate bookmark before
saving.");
}
});
return false;
}
First, I encountered 403 error and added javascript code of official
document to solve the problem.
After 403 error, the 500 error shows on firebug as "NetworkError: 500
INTERNAL SERVER ERROR - http://127.0.0.1:8000/save/?ajax".
The data can be updated, but the code as below doesn't action.
if (result != "failure") {
item.before($("li", result).get(0));
item.remove();
$("ul.bookmarks .edit").click(bookmark_edit);
}
else {
alert("Failed to validate bookmark before
saving.");
}
How to solve this?
Thanks!!
On Nov 20, 2:32 am, Tsung-Hsien <jasoniem9...@gmail.com> wrote:
> The error does not show on Django, but firebug shows the error.
> I refer "Django 1.0 Web Site Development" and use the jQuery code
> below:
>
> function bookmark_save() {
> var item = $(this).parent();
> var data = {
> url: item.find("#id_url").val(),
> title: item.find("#id_title").val(),
> tags: item.find("#id_tags").val(),
> };
> $.post("/save/?ajax", data, function (result) {
> if (result != "failure") {
> item.before($("li", result).get(0));
> item.remove();
> $("ul.bookmarks .edit").click(bookmark_edit);
> }
> else {
> alert("Failed to validate bookmark before
> saving.");
> }
> });
> return false;
>
> }
>
> First, I encountered 403 error and added javascript code of official
> document to solve the problem.
> After 403 error, the 500 error shows on firebug as "NetworkError: 500
> INTERNAL SERVER ERROR -http://127.0.0.1:8000/save/?ajax".