Help with using the timeout function to set a delay

I’m trying to delay this line by 1 second, but can’t seem to figure out the syntax.


window.location.href="index.php?vid_id="+<?php echo $vid_id +1 ?>;

this is the entire function


$('#cancel').click(function() {
			$.ajax({
		    type: "POST",
		    url: "scripts/greenlight.php?vid_id="+<?php echo $vid_id ?>,
		    data: "vote=2",
		    success: function(){
		    }});
			document.getElementById("greenlight").src="img/greenlight_btns/greenlight_btn.png";
			document.getElementById("cancel").src="img/greenlight_btns/cancel_btnOver.png";
			//window.location.href="index.php?vid_id="+<?php echo $vid_id +1 ?>
			window.setTimeout(function()
			{
    			window.location.href="index.php?vid_id="+<?php echo $vid_id +1 ?>;
			}, 1000);
			
			}); // end click

Try it by 10 seconds instead - you should then be able to easily determine if what you’re doing works or not.