I have to create a site that looks like tumblr and instagram and shows all pictures which are stored in one directory. When you scroll to the end of the page I want to load new pictures but I am a Ajax beginner and dont have a clue how to do this. I think my program will work but I need a PHP variable in the Ajax call. How can I do this?
关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率

已采纳
Ajax调用中的PHP变量
收起
- 写回答
- 好问题 0 提建议
- 关注问题
微信扫一扫
点击复制链接分享
- 邀请回答
- 编辑 收藏 删除 结题
- 收藏 举报
1条回答 默认 最新
- 关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率
douhao2011 2015-09-15 13:13关注You can simply echo it into the script the same way you would echo it onto an html page
<script> ... var phpvar = <?= $php_variable ?>; ... </script>
本回答被题主选为最佳回答 , 对您是否有帮助呢? 本回答被专家选为最佳回答 , 对您是否有帮助呢? 本回答被题主和专家选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏举报微信扫一扫
点击复制链接分享
评论按下Enter换行,Ctrl+Enter发表内容
报告相同问题?
提交
- 2017-08-14 20:08回答 3 已采纳 You don't want to do the live updating with PHP variables, since those are only refreshed when the
- 2019-04-27 01:21回答 1 已采纳 You can call the function when the get emaiAddress is detected on your database.php page. For exam
- 2015-12-01 18:44回答 1 已采纳 You need to add the response to the page using jquery. .done(function(response) { console
- 2020-10-23 22:13在Ajax调用过程中,请求主要包含以下几个重要参数: - **action参数**:用于标识需要调用的PHP后台函数。本例中,action参数设置为"LoginController/login",指明了需要调用的类LoginController中的login方法。 - *...
- 2017-02-20 03:38回答 3 已采纳 The return type is a JavaScript object, which will result in what you see. First, you should cons
- 2017-11-25 07:49回答 4 已采纳 The user locates example.com/index.php, it displays a webpage. You get the user's location from J
- 2019-04-28 05:11回答 3 已采纳 When referencing array keys, you must enclose them in quotes, change your function to the followin
- 2020-10-17 09:55jQuery中的Ajax调用主要通过$.ajax()方法实现。该方法提供了一种灵活的方式来处理各种类型的HTTP请求,并且可以接收来自服务器的响应数据,使得开发者能够根据这些数据动态地更新页面。$.ajax()方法的语法如下: ``...
- 2017-07-27 06:30回答 3 已采纳 Edit as per this comment: You don't need any JavaScript to accomplish "post and redirect in one g
- 2018-12-04 15:35回答 1 已采纳 You can use call_user_func passing the function name sent by ajax as argument. Like this: <?ph
- 2014-04-19 02:21回答 2 已采纳 if(isset($_GET['logout'])){ if(!isset($_SESSION)) { session_start(); }
- 2024-06-13 16:101. **接收请求**:在PHP脚本中接收AJAX发送的数据,通常通过`$_GET`或`$_POST`变量获取。 2. **处理逻辑**:根据接收到的数据执行相应的业务逻辑,例如查询数据库、处理文件等。 3. **返回数据**:处理完成后,将...
- 2020-10-26 05:36根据给定文件的内容,本文将详细介绍如何在PHP中实现一个简单的Ajax实例。Ajax(Asynchronous JavaScript and XML)是一种在无需重新加载整个页面的情况下,能够更新部分网页的技术。通过Ajax,Web应用程序可以更快...
- 2020-10-20 22:19总结来说,PHP+jQuery+AJAX实现分页的过程主要包括前端使用jQuery发送AJAX请求,服务器端PHP处理请求并返回分页数据,前端接收到数据后更新页面内容,并动态生成分页条。这种技术方案使得用户可以在不刷新整个页面的...
- 2022-06-19 08:05- **Ajax调用**:当用户提交留言时,JavaScript会创建一个XMLHttpRequest对象,通过其send()方法向PHP服务器发送POST请求,携带用户输入的留言数据。 - **数据传输**:虽然名称中有XML,但现代Ajax更常使用JSON...
- 没有解决我的问题, 去提问