Reputation: 363
After inserting some text into a div I call setTimeout()
with a redirect which doesnt work, I'm using an almost identical script I use in another project which does work, I do not undrstand why?
script that works
$.getJSON("http://newberylodge.co.uk/webapp/includes/login1.php",{username:childsname,password:password},function(json) {
if(json.result === "success") {
$("#add_err").html( "Welcome "+childsname+"!");
setTimeout(function(){
window.location= "menu.html";
},2000);
}else{
$("#add_err").html(json.message);
}
});
}
script that isnt working
$.post("includes/addVolunteer.inc.php",{volunteerName:volunteerName,volunteerCity:volunteerCity, volunteerCounty:volunteerCounty,volunteerService:volunteerService,volunteerEmail:volunteerEmail},function(json) {
if(json.result === "success") {
$("#volunteerReport").html(json.message);
setTimeout(function(){
window.location= "view.htm";
},2000);
}else{
$("#volunteerReport").html(json.message);
}
});
}
I have checked for errors in console and there are none being shown
Upvotes: 0
Views: 47
Reputation: 1227
you can try like this
$.post("includes/addVolunteer.inc.php",{volunteerName:volunteerName,volunteerCity:volunteerCity, volunteerCounty:volunteerCounty,volunteerService:volunteerService,volunteerEmail:volunteerEmail},function(json) {
if(json[0] === "success") {
$("#volunteerReport").html(json.message);
setTimeout(function(){
window.location= "view.htm";
},2000);
}else{
$("#volunteerReport").html(json.message);
}
});
}
I'm not sure but it's helpful to you.
Upvotes: 1