输入url就可以准备好AJAX内容吗?
我使用一些 AJAX 创建了一个页面来调用嵌入视频流。每次点击图像都会显示我使用的该频道的嵌入
在使用之前php;因此,如果我进入网站,我所使用的就是 echo
,在这种情况下,我会使用 else
选项将默认选项设置为我的频道之一将其设置为立即自动播放其中一个频道。
因此,就 php 而言,如果 else
中的默认值是我的频道之一,当我的访问者进入该网站时,该频道将显示在第一个索引页上,那么我的问题就来了。
但是对于 AJAX 来说什么都没有,除非你点击 onClick
所在的频道
,并且每次你点击任何 AJAX 项目时它只会有 #
符号,但是使用 php 我可以设置类似 ?showtv=30
我想知道 AJAX 是否也可以以同样的方式实现,
我只是很好奇,因为我希望为每个频道制作一个 twitter 和 facebook 分享按钮,但是如果只有#
在 AJAX 上它永远不会链接到人们希望共享的频道。
谢谢!
/我希望我的问题没有让你们感到困惑,如果是的话我可以给出更好的解释[如果需要]\
编辑“”“
我所拥有的一个例子现在的 AJAX 在此页面 http://tv.yoursn0w.com 但每次点击频道就像http://tv.yoursn0w.com/# 并且无法直接进入特定频道,
但可以使用 php我可以制作类似 http://tv.yoursn0w.com/?channel=sports 的内容它会让我直接体育频道
I have created a page using some AJAX to call the embed video streaming. By every click on the image it will show the embed of that channel I use <li><a href="#" onClick="showtv('30')">
Before I use php; So if I enter the website what I use to have is the echo
which in that case I use to use the else
option to make the default option to one of the channel I set it up so it will auto play one of the channel right away.
So come to my question in the case of php if the default in the else
was one of my channel that will show on the first index page when my visitors entering the site.
but with AJAX nothing unless you click on of the channel where the onClick
and everytime you click on any of the AJAX items it will just have the #
sign but with php I can set something like ?showtv=30
I want to know if with AJAX also can be possible the same way
I'm just curious because I wish to make a twitter and facebook share button for each of the channel but if with only #
on AJAX it will never link to the channel people wish to share.
Thanks!
/I hope that my question didn't confuse you guys, if so I can give a better explanation [if required]\
EDIT"""
an example of what I have for the AJAX right now is in this page http://tv.yoursn0w.com but each of the click on the channel it will just be like http://tv.yoursn0w.com/# and can't go directly to specific channel
but with the php use I can make something like http://tv.yoursn0w.com/?channel=sports and it will bring me to sport channel directly
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对回答这个问题感到犹豫,因为我不太明白你在问什么,但我猜你想知道哈希标签是否可以像在 PHP 中的查询标签一样在 JavaScript 中使用。答案是肯定的。事实上,这正是这里要回答的
检索特定哈希标签的值from url
编辑
如果您想在 URL 的哈希部分发生更改时收到通知,请查看“hashchange” 事件。此处描述
On - window.location.hash - 更改?
I feel hesitant to answer this question since I don't really get what you're asking, but I gather that you wonder if hash tags can be used the same way in JavaScript as query tags in PHP. And the answer to that is yes. In fact, that's exactly what's being answered here
Retrieve specific hash tag's value from url
Edit
If you want to be informed when the hash part of the URL changes, check out the "hashchange" event. Described here
On - window.location.hash - Change?