I’m using JTube found over here: JTube at github
I’m trying to make a request on keyup instead of on submit. This is the script:
var qsParm = new Array();
function qs() {
var query = window.location.search.substring(1);
var parms = query.split('&');
for (var i=0; i<parms.length; i++) {
var pos = parms[i].indexOf('=');
if (pos > 0) {
var key = parms[i].substring(0,pos);
var val = parms[i].substring(pos+1);
qsParm[key] = val;
}
}
}
$(function() {
qs();
if(qsParm['search'] == '' || qsParm['search'] == null || qsParm['search'] == undefined)
qsParm['search'] = 'splinter cell';
else
qsParm['search'] = unescape(qsParm['search']);
$('input[name=search]').val(qsParm['search']);
$.jTube({
request: 'search',
requestValue: qsParm['search'],
limit: 10,
page: 1,
success: function(videos) {
$(videos).each(function() {
$('#example').append('<li><a href="'+this.link+'"><img src="'+this.thumbnail+'"><br>'+this.title+'</a> - '+this.length+'</li>');
});
},
error: function(error) {
$('#example').html(error);
}
});
});
As far as I understand the function is ”qs” So therefore I tried:
$("input").onkeyup(function(){
qs();
return false;
});
Did not work. I tried many other things with no success. Help is appreciated.
You need to call the “sendQS” function (which is anonymous in your example) to actually send the data. Also, the jquery function is
keyupnotonkeyup.