Sunday, November 20, 2011

Get 500 error with Ajax on firebug

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".
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!!

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate