The following jquery code is expected to work.
Copy Code code as follows:
$ (". Derek"). each (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.