The following jquery code is expected to work.
$ (". Derek"). each (the function () {
$ (this). Click (function () {
var params = $ (this). Parent (). Serialize ();
var obj=$ (this). Parent (). Siblings ("Div#caskcontent");
var form=$ (this). parent ();
$.ajax ({
URL: "editcaskcontent",
type: "Post",
Data:params,
dataType: "JSON",
success: Function (e) {
obj.empty ();
Obj.html ("<font color=\" #00AA00, "> Cross-examine:</font>");
Obj.append (e.caskcontent);
Form.toggle ();
Alert ("modified successfully.") ");
},
error:function (e) {
alert (e);
}
}
);});As you can see, before I made the AJAX request, I defined two variables, obj and form, to store two jquery objects, respectively. If you use the $ (this) in the Ajax callback function, the practice proves that you can't get any objects. Specific reasons, I hope the great God message advice.