2

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.

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. Commented May 2, 2011 at 19:43
  • 2
    "How do I do AJAX without AJAX because one line of code is too long?" >.< Commented May 2, 2011 at 19:58

2 Answers 2

8

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

$('#div_id').load('url');
Sign up to request clarification or add additional context in comments.

1 Comment

ninja'd! that always happens to me
2

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

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

Should do the trick.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.