Brothers, consult a Ajax returns the data bound to the template problem.

I have the following code:
<th style="border-bottom:1px solid red" colspan="0">
Check</th>
<th style="border-bottom:1px solid red">
UserName</th>
<th style="border-bottom:1px solid red">
Password</th>
</tr>
</p>
<p>
<tr id="template"><td id = "UserCheck" >
</td>
<td id="UserName">
</td>
<td id="Password">
</td>

Data dynamic Ajax returns to the bonding to the upper template, such as a list of 100 data, now I also increased the query functions, such as query to the data in the database, and now I want to still in this template bonding, this shows that a new query to the data, but this time the state will not take effect, before the data and display the template, this have what way you clear?

Waiting in line. . . . .

Started by Hardy at November 13, 2016 - 6:53 AM

Your code.. Paste up have a look

Posted by Gordon at November 26, 2016 - 7:34 AM

Below is the Ajax returns data bound template.:

success: function(data){
if (data.error) { // script returned error
$('div#DeleteUsersResult').text("data.error: " + data.error);
$('div#DeleteUsersResult').addClass("error");
} // if
else {

var userList = data.table;

for (var one in userList)
{
var row = $("#template").clone();
row.find("#UserCheck").html("<input type=\"checkbox\" name=\"UserSelect\" id = \"UserSelect\" value = \""+ userList[one].username +"\"/>");
row.find("#UserName").text(userList[one].username);
row.find("#Operation").html("<a href = \"http://localhost/cgi-bin/CGIProgram.exe?" + "Command=Delete&" + "username="+ userList[one].username+"\">" + "Delete" + "</a>");
row.appendTo("#datas");
}
} //else
} // success

Posted by Hardy at December 02, 2016 - 7:57 AM

Enter the success callback? And you stick out of the HTML code does not ID datas controls.

success: function(data){
  if (data.error) { // script returned error
$('div#DeleteUsersResult').text("data.error: " + data.error);
$('div#DeleteUsersResult').addClass("error");
 } // if
 else {
alert('Success')/////////Whether to enter a success callback.
var userList = data.table;

alert(userList.length)/////////Look at length
for (var one in userList)
{
var row = $("#template").clone();
row.find("#UserCheck").html("<input type=\"checkbox\" name=\"UserSelect\" id = \"UserSelect\" value = \""+ userList[one].username +"\"/>");
row.find("#UserName").text(userList[one].username);
row.find("#Operation").html("<a href = \"http://localhost/cgi-bin/CGIProgram.exe?" + "Command=Delete&" + "username="+ userList[one].username+"\">" + "Delete" + "</a>");
row.appendTo("#datas");
}
} //else
} // success

Posted by Gordon at December 10, 2016 - 8:32 AM

Before the first empty data binding, and then bound

Posted by Hugo at December 14, 2016 - 8:57 AM

The response to 2012-12-10 08:55:33 was removed by the administrator

Posted by Antoine at December 15, 2016 - 9:47 AM