i have added the code to detect undefined
if(typeof data === "undefined") { // do nothing } else { window.location.href = data; }
but even after showing alert it still going to undefined url why?