简体   繁体   中英

How do you make a web page change without reloading the page?

What should I look into to accomplish this.

When you select an input field some text to the right shows up.

For example: https://twitter.com/signup

Anyway i need something like that works with PHP. What should I look in to?

And also How can you query the database and not have to reload the page to see result? For example i have seen on many sites registration you can check if the a username is used without the page reloading. Dont know how to explain better.

Thanks

Like Arkain said, they are making the text appear with JavaScript. PHP is server-side only, meaning it can't make any changes to the page once it has loaded.

You can however, call a PHP script dynamically (to check if a username is registered) using a technique called AJAX .

您需要使用JavaScript,看看这个来源,例如,对于一些新手教程。

I'd look into Ajax using jQuery. I had done some things with ajax before trying jQuery but jQuery made it so easy that I found it enjoyable to keep implementing things using it.

Learn JavaScript. You can start with jQuery (a pre-made javascript toolkit of functions that help you do many things without reloading the page).

Google for a jQuery Ajax tutorial.

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