Reputation: 6199
I Have the following code i am trying to redirect the page to the same page but with a int on the link but it keeps coming up with page error.
var done_update = '&updated=1';
window.location = window.location.href.done_update;
Thank you,
Upvotes: 0
Views: 256
Reputation: 13491
var done_update = "&update=1";
location = location.href + done_update;
String concatenation in JavaScript is done using the +
operator, not .
as in other languages (Perl, PHP...)
location
is a global variable, there is no need to specify window.location
Upvotes: 1
Reputation: 11110
var done_update = '&updated=1';
window.location = window.location.href+done_update;
Upvotes: 2
Reputation: 30621
String concatenation is done in JavaScript (and Java for that matter) using a +
and not a .
:
var done_update = '&updated=1';
window.location = window.location.href + done_update;
Upvotes: 2