[Answered ]-Rebuild content of a Div tag in complete function of $.ajaxt

1👍

Template are compiled on server side and the browser renders the HTML.

To update your div after ajax call, you’d need to update it using javascript code in complete method. Your server side view can return JSON, XML, HTML or any other data type and your complete method has to render that data. Here is an example of how your complete method should look like if your server side returns partial html (i.e. just the table):

complete:function(data) {
        $('#tablepro').html(data);
},
👤Irfan

1👍

Remember that templates are compiled on the server side and the resulting HTML is then passed to the client. This means that the template code you have within your complete function (in the ajax call) will always be the same – in other words, every time you delete an element (and remove is called), you are redisplaying all the original categories again, as the HTML generated within the for loop is created on the server side once – not asynchronously

Leave a comment