Im new to coding, so if you can keep that in mind when explaining. Struggling with the Youtube pageToken & nextPageToken. I cannot figure out how to call more results once I have my first group. I see the nextPageToken code, but confused on how to use it to get the next set.
The YT api doc page says I need a string in the nextPageToken, but what does it have to say & how do I call it?
Sorry if Im unclear, like I said, Im new & learning how to explain my issues.
I have found your the issue and managed to fix it.
You never pass the pgToken when calling getNextVids() So for some reason it isn't updating.
Swap:
function getNextVids(vidSearch, pgToken){
For:
function getNextVids(vidSearch){
and all should work fine.
Also you don't need the onclick attribute on your next button as you have jQuery dealing with that event.
<button class='next'>Next page</button>
CodePen Demo
I hope this helps you.
Happy Coding!
Related
Recently i came across the PerformanceObserver,
(https://developers.google.com/web/updates/2016/06/performance-observer
https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver)
It provide option for tracking longtask, I added in my code and got some longtask, result looks like this
There is no information about where it happening and what triggers it. Please help me to understand what is long task and how to fix it.
Thanks
im working on a Wikiviewer for FreeCodeCamp and i've run into a strange issue.
I have just a basic example running right here (it aint pretty at all right now, just proof of concept):
http://codepen.io/msmith1114/pen/peBKxM?editors=1111
im appending here(in the JS code, there isn't very much):
$("#links").append('<li>' + arrayName[0] + '</li>');
$("#links").append('<li>' + arrayName[1] + '</li>');
$("#links").append('<li>' + arrayName[2] + '</li>');
})
So this really has 2 issues (and if you try it with console open you'll see)
1st Main issue: The list will show up (3 links) and then disappear...which makes no sense. jquery.append() should leave them there as far as Im aware, since im appending them to the in my html section
2nd issue: It seems like sometimes getJSON will not return anything. I thought wrapping my statements in the .done() section would make sure not to do anything until the Wikipedia API has returned everything would work but sometimes you just don't get anything back. Is this a WikiAPI problem or something else? (BTW if it doesn't work, just keep typing in "cat" or something in the searchbox and hit search again, it'll eventually work until you run into problem 1 above).
Thanks. Im still learning JS/Jquery so im a bit puzzled why this won't work.
The first issue is because you've hooked to the click of the submit button. This doesn't stop the form submission, hence the page gets reloaded. Use the submit event of the form element instead and be sure to call preventDefault() on the provided event:
$(".form-inline").submit(function(e) {
e.preventDefault();
// the rest of your code here...
});
As for the second issue, it could be a limiting issue. Without seeing an error it's going to be impossible to give you a definitive answer
I'm just trying to do some simple calls on youtube videos such as using their seekTo() method and getTimeStamp() sort of thing. I'm struggling to follow the documentation and was wondering if anyone knew of any example code I could look at?
e.g. Working with embedded videos -
Currently using -
Is it as simple as adding enablejsapi=1 like so?
link = http://www.youtube.com/v/VIDEO_ID?version=3&enablejsapi=1
How exactly do you call methods such as seekTo() etc. then? Sorry if this is unclear.
As JCD indicated as well, the YouTube Player API is a great starting point for what you might need to do.
It goes into detail on where to start, how to load videos, JS functions used, etc.
seekTo(...) requires 2 parameters, seconds and allowSeekAhead. Its recommended to set allowSeekAhead to false when the user is dragging the progress bar and true when user releases it.
Everything was working fine yesterday. I have not touched the code nor made any changes. To clarify what isn't working, when I type my term to search and hit "find" or "enter" nothing happens. The bulk of the code that makes that work is the JavaScript with the exception of the call to the input on the HTML.
Here is the jsbin. Any ideas would be appreciated. I also tried a new API key and that doesn't work either.
Instead of your line:
video.src = video_url;
you need the following line:
$('#video').attr('src', video_url);
I determined the issue. Googles AJAX API was down. Thank you for your help!
So heres my problem:
The code only works, when I leave the page to a different url (in the same browser window) and then press the back button.
What could be the reason for such an odd behavior? Any hints where and what to look for?
I know its not a specific question but a general one, because i hope to get guidance so someone can hint me to the "desease" by me describing the symptons (Dr.House-style) so I get a good start for finding the bug.
So i hope this is ok to ask.
Anyhow, if it needs to be specific, here is the code that is acting so strangely:
2 scripts (FitVids.js, Vimeo.js) together kill Calling a function to play video, resulting in: VimeoAPI is not a function
I would assume that means that VimeoAPI is not a function. :) You may be spelling it wrong, capitalizing it wrong, or it may not be defined yet. Try posting your code clearly on your post.