javascript - 问:加载新的 PHP 变量值而不刷新
问题描述
我想知道如何在分配 PHP 变量示例后加载或刷新它们:
<?PHP
if(isset($_POST['rnd])){$post = $_POST['rnd'];}
?>
<input name='rnd' value='hey'> //insert any value
<?PHP if(isset($post)){?>
<div><h1><?PHP echo $post ?></h1></div><?PHP }?>
但是如果我这样做,我必须刷新页面以加载新值,所以我正在寻找如何在不刷新页面的情况下加载新值,我搜索了整个互联网并没有找到有用的结果,无论如何语言是什么,所以任何事情都会有所帮助。
解决方案
This question is a little vague. The answer depends on what you are trying to achieve and/or build.
- Is your form action set to current page or PHP_SELF
- Depending on what it is you are building you can create custom functions
- If all else fails check the documentation. Should not have a problem displaying user input data on form submission.
- Also, as was previously stated you could use AJAX.
推荐阅读
- java - java.lang.SecurityException: Permission Denial: 打开提供者 com.miui.gallery.provider.GalleryOpenProvider
- reactjs - 尝试通过 web3.js 将 Metamask 钱包连接到我的反应应用程序
- java - 标准生成器解析路径内容
- python - 矩阵向量的乘法
- vba - 如何通过 VBA 重新填充 microsoft access 365 中的导航窗格?
- typescript - 如何将获取的数据与 Next.js 和 TypeScript 一起使用?
- javascript - 悬停在 D3.js 折线图中未定义的数据点返回
- mysql - 如何计算表中值之间的时间?
- python - 如何确保用户输入仅使用 try 和 except
- android - 获取 'E/RecyclerView: 未连接适配器;Kotlin tabbedActivity 中的跳过布局