Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a webpage with a lot of youtube and soundcloud music to listen to and I was wondering what the best way would be to make it so that the music portions would not reload when certain things where clicked i.e. logging in.
Refreshing the page would start the music over again.
Ideally I would like the page to be able to play a song that would say store a small thumbnail in the corner and then the user could navigate the page freely with it still running. Kind of like how the youtube app works or, http://hypem.com
I saw someone write this bit of code, which seems pretty interesting:
<html>
<body>
<div id="projects">
<? $page = file_get_contents("projects.html"); echo $page; ?>
</div>
</body>
</html>
I'm not sure how it all works or if it is what I want so can someone point me in the right direction to achieve this?
The sample you posted will not do what you want. That will load "projects.html" and render it server-side; it will cause a full page refresh when viewed. It's not even very good code.
You basically have two options, and you've already listed one of them: Frames or ajax. Frames are the old school way of doing it and generally isn't recommended. So I recommend to go read some tutorials on Ajax/XHR to familiarize yourself with it, and then you should be able to figure out how to load chunks of content onto your page without causing a full page refresh.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm working with PHP and I want to scrape some data from any website. But I have a problem. I scrape data but these items number are 48. But I know that page has 11K items. Rest of datas extend when you scroll and you get new bunch of datas (48 items).
I'm scraping with simple_html_dom. How can I manipulate scroll and get data ?
Thanks! :)
Sounds like the missing data is loaded via ajax.
Check the Network tab in the Developer Console (by pressing F12). Take a look at the URL which is being called (and the response), and edit it to your needs. Then call this URL instead of the one you are taking now.
It is impossible by this way.
But if you need to scrap this data you can send requests to endpoints which return lazily loaded data. You must research js code of target site.
p.s.
If you want to use really hard approach, you can research browser emulating.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm having problems on finding a easy solution to present a news frame on top of the already established website first page.
The site should open with a news frame on top of the first page and close either by closing the frame or after a given time.
The site is developed with PHP and some JS for some specific functions and for what I could understand it uses some template which I can't identify.
I appreciate any help you can give me to point me in the right direction.
What you want is essentially to have a modal with all your news content in it. And you need a link to trigger that modal, so you need to create a hidden one. This is the general flow you should take to make it pop up the first time.
<div class="modal"....>
......
</div>
Now to make it auto trigger, you'll need this little piece of jQuery.
jQuery(document).ready(function() {
jQuery('a#news-model').trigger('click');
});
Note: If you only want it on the home page, only add it there!
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I know how to read and parse XML with PHP, but is there a way to make it auto advance through pages of XML data automatically? I work for a TV station that is featuring open houses via a real estate xml feed and need to show one or two houses at a time for a half hour without requiring someone to sit there and advance the pages themselves. Any thoughts would be appreciated!
You could have PHP output the necessary JavaScript to redirect to the next page.
Here's how to redirect to a new page: How can I make a redirect page in jQuery/JavaScript? combine that with setTimeout() to add a delay.
I'm not sure whether I would rely on this for a live TV feed, though - I'd be too scared of the embarrassment of the browser crashing, or an error popping up....
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Personally I would do this with PHP but maybe someone has an pro/contra for doing this with JavaScript:
I (will) fetch a few song details (about ten per page load) from Soundcloud
afterwards the statistic (played this week/total, liked this week/total etc.) will be displayed in a table
That's it - nothing special.
I can solve it like this:
let PHP do the stuff and render the whole page at once
This will of course take some time before the page is rendered.
Is there any advantage of doing this with JavaScript? I can only think of:
the page renders faster (with the disadvantage that the results may not be displayed instantly)
I'd say that doing it via JavaScript will actually take longer, as you'll have to connect again. Although, it may give an illusion of "being faster" (though I doubt it'll be noticeable).
I suppose it might depend on your usage cases too.
How are you handling authentication with SoundCloud?
I would honestly go the jQuery route.
Use a $.post() call, and within your success statement, loop through the json and append it to a table. This way, you can do something like pagination, which can update your table without needing to refresh the page.
Do it serverside and pre-load the page. The soundcloud API should not be the bottleneck here so reducing a request or two is worth it.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Okay, bear with me. Part of my job is filling out online forms for customers who call in. In these forms there are all kinds of useful information that is hidden in input tags. I would like to make my own page that would extract and display all this useful information. I would also use this page to count the number of times I submit the form throughout the day.
The way I currently have it set up it is in a frameset. The left frame has links to the different forms we fill out, and when I click on one the external form is populated in the right frame. Javascript would be perfect for the job except that my frame is not located on the same server as the forms.
I stink at PHP. Not gonna lie. So i'm not looking for any hand-outs but any pointers would be great.
For example you may check out the forms on http://www.youcangetacar.com and you may use the pin code "A101" or you can check out what I have so far at http://customertrack.host-ed.me/
Make a page that cURL’s the page that is passed to it via url(curl.php?url=http://www.google.com) and then you dont have trouble with same domain policy.
Don’t forget to string replace relative urls with absolute urls.
eg, action="/submit/form.php" must become action="http://www.domain.com/submit/form.php"