Chris
Chris

Reputation: 167

Get PHP file using Javascript/JQuery

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.

Upvotes: 2

Views: 1906

Answers (2)

colinmarc
colinmarc

Reputation: 2471

if <div id='mydiv'></div> is your target:

$('#mydiv').load('/address/to/page');

Should do the trick.

Upvotes: 2

mellamokb
mellamokb

Reputation: 56769

I think you are looking for jQuery's $.load.

$('#div_id').load('url');

Upvotes: 8

Related Questions