I need to use javascript or jquery to get a html or php file and put its contents inside a div of the current page.
I know how to do this using ajax but would like to know if there is a simpler way without having to use all the code that ajax uses.
I need to use javascript or jquery to get a html or php file and put its contents inside a div of the current page.
I know how to do this using ajax but would like to know if there is a simpler way without having to use all the code that ajax uses.
Share Improve this question edited May 2, 2011 at 19:43 Mark Biek 151k54 gold badges159 silver badges201 bronze badges asked May 2, 2011 at 19:41 ChrisChris 1671 silver badge8 bronze badges 2- 2 What "all the code"? An AJAX call with jquery is all of one line of code with about 3 or 4 arguments chained together. – Marc B Commented May 2, 2011 at 19:43
- 2 "How do I do AJAX without AJAX because one line of code is too long?" >.< – Lightness Races in Orbit Commented May 2, 2011 at 19:58
2 Answers
Reset to default 8I think you are looking for jQuery's $.load.
$('#div_id').load('url');
if <div id='mydiv'></div>
is your target:
$('#mydiv').load('/address/to/page');
Should do the trick.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744890807a4599401.html
评论列表(0条)