elzi
elzi

Reputation: 5672

Load php page results into div with ajax with link?

I am trying to replace an iframe, essentially. I would like to load the result of a php page into a div. The results are being parsed through URL - http://example.com/view.php?id=1 - for exmaple. Sorry, I don't have much experience with javascript.

The closest example I could find is here: http://www.w3schools.com/PHP/php_ajax_database.asp

But that is for a select box.

Could anyone else possibly?

Upvotes: 1

Views: 5803

Answers (1)

mario
mario

Reputation: 145482

If you want to use it as a link then the lazy solution is:

<div id=content> loaded page goes here </div>

<a onclick="$('div#content').load('http://example.org/ajax.php?id=1')">click</a>

Or even with the good ol javascript pseudo URI:

<a href="javascript:$('#id').load('url')">click</a>

Upvotes: 3

Related Questions