简体   繁体   中英

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?

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM