Im using javascript, jquery and jquery mobile.
I have this:
$(document).ready(function() {
$("#routes").change(function(){
var newValue = $("#routes").val();
if(newValue != -1){
newLocation="http://localhost:8080/map.jsp?route="+newValue ;
window.location.href=newLocation;
}
});
});
But the location.href is not redirecting me.
Any ideas?
EDIT:
I got this and its working now, my problem now is that map.jsp is not going executing the .ready event:
$.mobile.changePage('/map.jsp', {
reloadPage: true,
type: "get",
data: 'route='+newValue
});
As per Hogan Answer he is right just use
window.location = newLocation; return false;because i ran same problem and using just window.location solved my problem.And one more thing you might need to look for is # in the end of url i don’t know but having # at the end of url not redirecting when you use
window.location.Hope this will help.