如何在锚标记中传递div ID和查询字符串 [英] How to pass div id and query string in anchor tag

查看:93
本文介绍了如何在锚标记中传递div ID和查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在锚标记中传递div ID和查询字符串.
这是我的代码:

How to pass div id and query string in anchor tag.
This is my code:

<a href="#cart?product_name=traditional">Product</a>
<div id="cart">
echo $_GET['product_name'];
?>
</div>


该值未显示.


The value is not displaying.

推荐答案

_GET ['product_name']; ?> < /div >
_GET['product_name']; ?> </div>


该值未显示.


The value is not displaying.


有关:
<a href="#cart?product_name=traditional&divId=cart">Product</a>


其中有两个查询字符串:
1. product_name
2. divId


There are two query strings in it:
1. product_name
2. divId


您似乎通过尝试将PHP和javascript混合使用.锚链接不会回发到服务器.所以echo
You seem to by trying to mix PHP and javascript. The anchor link will not do a postback to the server. So echo


这篇关于如何在锚标记中传递div ID和查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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