开发者

JQuery Function import html from external source

I have this JQuery function:

function addSomeHTML()
        开发者_如何学C    {
                  $("#mysection").html("<div id='myid'>some content here</div>");
            }

I basically need this part: <div id='myid'>some content here</div> to be read from an external file.

Can anyone help please?

Thanks


Use the AJAX load() method.

$('#mysection').load('yourfile.html');

Of course the URL can also point to a PHP script etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜