window.location.href doesn't redirect
If you are calling this function through a submit button. This may be the reason why the browser does not redirect. It will run the code in the function and then submit the page instead of redirect. In this case change the type tag of your button.
From this answer,
window.location.href not working
you just need to add
return false;
at the bottom of your function
Solution from here:http://www.codeproject.com/Questions/727493/JavaScript-document-location-href-not-working
document.location.href = 'Your url',true;