Remove Block Element

js Dec. 20, 2015, 3:04 a.m.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
var data = JSON.stringify({});
        $.ajax({
            type: "GET",
            url: "{% url 'eventapi' %}" + "?limit=1",
            data: data,
            contentType: "application/json",
            success: function (data) {
                if (data.count == 0) {
                    $("#eventblock").remove();
                }
                else {
                    $("#eventblock").append("<p>test</p>");
                }
            }


        });

You can remove element using

$("#id").remove();

 

Any thoughts?