I’m trying to reload a page with an appended variable in the URL, deviceID. It shows up in “realtime” div just fine. What am I doing wrong?:
document.getElementById("realtime").innerHTML = "<pre>"+JSON.stringify(msg)+"</pre>";
var obj = jQuery.parseJSON(JSON.stringify(msg));
var deviceId = obj.deviceId;
var pathname = window.location.pathname;
var pathAppend = pathname + "?deviceId=" + deviceId;
window.location.reload(pathAppend);
It’s because you’re using
window.location.reloadincorrectly.reloadaccepts a boolean which:You should do something like: