jQuery to change <td> values using $.ajax

KontroL

New Member
I have a table like this:\[code\]<table id="table-name"> <tr><td id="td-name">something</td></tr> <tr><td id="td-name">something</td></tr> <tr><td id="td-name">something</td></tr> <tr><td id="td-name">something</td></tr></table>\[/code\]And I'm trying to change the "something" value using jQuery like this:\[code\]$("#table-name #td-name").each(function () { $.ajax({ type: "POST", url: "file.asp", data: $(this).html() }).done(function r(returnOfASP) { $(this).html(returnOfASP); }); });\[/code\]It does database query with an "file.asp". "something" is the parameter of the database query. "file.asp" return the query correctly, but I can't change the \[code\]<td>\[/code\] value (html). I suppose \[code\]$(this)\[/code\] in "done" of Ajax is not correct, but I don't know what to do.
 
Back
Top