How can jQuery load some html and append it to the <body> element?

后端 未结 5 500
小蘑菇
小蘑菇 2020-12-10 10:37

I tried the following:

$.load(\"Views/chatBox.html\").appendTo(\'body\')

Console Output:

TypeError: $.load is not a functio         


        
5条回答
  •  长情又很酷
    2020-12-10 11:33

    An alternative solution:

    jQuery('#AppendToMe').append( jQuery('
    ').load(...) );

    This will append whatever you load into the #AppendToMe element.

提交回复
热议问题