开发者

php execute page

I want to call a page (click.php) on a click of a button, click.php executes a php-mysql command that inserts a value into a table. Is there a way t开发者_运维百科o click the button and have the page execute without page load. An example: when you do +1 rep on this website to someones post, Im assuming its database driven and when you give them rep, it adds +1. I want to do something basically like that. Is it possible with php, if not in javascript a way to call that page?


Look into XMLHttpRequest: http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=XHR
and Ajax : http://en.wikipedia.org/wiki/Ajax_(programming)

Basically: create an XMLHttpRequest,
open your .php,
send(null) and viola, you're done.

What XHR does, is it requests the page in the background and loads it in the background. Thats pretty much all you need.

If you need the content of the page, you should look into XHR.onreadystatechange and XHR.responseText

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜