开发者

load content of file with jquery

开发者 https://www.devze.com 2023-01-01 22:28 出处:网络
I have a php file sitting in a directory.The file has some content to it that is just html.All I would like to do is to use JQuery to get the file contents and place then in a div on my page.

I have a php file sitting in a directory. The file has some content to it that is just html. All I would like to do is to use JQuery to get the file contents and place then in a div on my page.

 $(".page-intro").load("barware-title.php");

I have tried to use above code to load the page, but nothing happens.

Here is my Div

<div id="page-intro"></div>

I am at a loss for why this isn't working.

开发者_运维技巧

Thanks for the help.


You need to address by id (#), not class (.)

$("#page-intro").load("barware-title.php");


Your selector is wrong. You should use

$('#page-intro')

The .page-intro is looking for a class name of page-intro.


Change .page-intro to #page-intro. It's an id not a class.

0

精彩评论

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