使用PHP变量并将其用于Jquery/Ajax页面加载请求 [英] Using PHP variable and use it in Jquery/Ajax page load request

查看:95
本文介绍了使用PHP变量并将其用于Jquery/Ajax页面加载请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我已经设置了一个PHP变量,如下所示:

Let's say I have set up a PHP variable like this:

$phpurl = $_GET["url"] 

其中,url值将来自GET变量查询. "url"的值将是某种html页面链接,其中包含一些要加载的内容,例如"myContent.html".

where url value will be from GET variable query. The value of "url" will be some sort of html page link with some content like "myContent.html" I want to load.

如何获取已分配给变量"$phpurl"的"url"值 并在Ajax/Jquery页面加载请求中使用它?

How can I get this "url" value, which I have assigned to the variable "$phpurl" and use it in the Ajax/Jquery page load request?

$('.content').load('  ** need the value of "$phpurl" to be placed here ** ');

希望问题很明确.我是编程新手.谢谢.

Hope the question is clear. I am pretty new into programming. Thanks.

推荐答案

$('.content').load('<?php echo json_encode($phpurl); ?>');

会做

这篇关于使用PHP变量并将其用于Jquery/Ajax页面加载请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆