i have this and a simple question to it.
$.ajax({
type: "POST",
url: "/",
data: $(".form").serialize(),
dataType: "html",
success: function (data) {
$("#id").html(data);
}
});
Inside "data" is some html I am inserting into the DOM. Thats no problem. But I want to manipulate the "data" before doing so. How can I do that? For example there are some li elements in "data". How would I for example delete the last li element out of the "data" string before inserting it into the DOM?
I tried something like
$(data li:last)remove();
...but that didnt work.
Thanks for your help.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…