In my code i am getting this error
Uncaught TypeError: Cannot read property 'toLowerCase' of undefined
but when I remove
delay(function(){ ... }, 1000);
from my source file my code works perfectly I don't know what I am doing wrong with it or missing something that is really important to do, here is my full code
function checkurl(textname) {
$.ajax({
type: "POST",
url: "includes/modContent/checkurl.php",
data: "checkurl=" + textname,
dataType:'text', //or HTML, JSON, etc.
success: function(response){
//alert(response);
textname = response;
}
});
return textname;
}
$('input[name=txtPageName]').keyup(function() {
delay(function(){
$('input[name=txtSeoURL]').val(checkurl($(this).val()));
}, 1000);
});
var delay = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();