Javascript / jQuery Exec turns up Null
Posted
by Matrym
on Stack Overflow
See other posts from Stack Overflow
or by Matrym
Published on 2010-05-27T08:11:40Z
Indexed on
2010/05/27
8:21 UTC
Read the original article
Hit count: 267
How do I skip over this next line if it turns out to be null? Currently, it (sometimes) "breaks" and prevents the script from continuing.
var title = (/(.*?)<\/title>/m).exec(response)[1];
$.get(url, function(response){
var title = (/<title>(.*?)<\/title>/m).exec(response)[1];
if (title == null || title == undefined){
return false;
}
var words = title.split(' ');
$.each(words, function(index, value){
$link.highlight(value + " ");
$link.highlight(" " + value);
});
});
© Stack Overflow or respective owner