$.ajax({
    method: "POST",
    url: "api.php",
    data: {
        userid: '1',
    },
    dataType: 'json',
    cache: false,
    success: function(value) {
        if (value.status == 'success') {
            swal({
                title: "success!",
                text: value.msg,
                type: "success"
            });
        } else if (value.status == 'error') {
            swal({
                title: "error!",
                text: value.msg,
                type: "error"
            });
        };
    },
    error: function() {
        swal("ERROR");
    }
});

动态增加一个内容到HTML:

$('#id').html('23');//#id or .classname