javascript - JQuery Function import html from external source - Stack Overflow

I have this JQuery function:function addSomeHTML(){$("#mysection").html("<div id=

I have this JQuery function:

function addSomeHTML()
            {
                  $("#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

I have this JQuery function:

function addSomeHTML()
            {
                  $("#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

Share Improve this question asked Apr 17, 2011 at 22:23 Satch3000Satch3000 49.5k90 gold badges225 silver badges349 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

Use the AJAX load() method.

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

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744696963a4588551.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信