Redirection in Javascript
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 = '&update开发者_JAVA技巧d=1';
window.location = window.location.href.done_update;
Thank you,
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;
var done_update = '&updated=1';
window.location = window.location.href+done_update;
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 specifywindow.location
精彩评论