简体   繁体   中英

Can AJAX content be ready by entering the url?

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

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM