I am trying to have the page be refreshed with one or more query parameters after the user clicks a submit input button. To do this, I have embedded a jQuery function in an HTML module. Here it is:
$('#display_graphs').click(function () {
var graph_1 = $('#graph_1').is(':checked') ? 1 : 0;
var graph_2 = $('#graph_2').is(':checked') ? 1 : 0;
var graph_3 = $('#graph_3').is(':checked') ? 1 : 0;
var graph_4 = $('#graph_4').is(':checked') ? 1 : 0;
if (!window.location.href.includes("&graph_1=")) {
window.location.href += '&graph_1=' + graph_1 + '&graph_2=' + graph_2 + '&graph_3=' + graph_3 + '&graph_4=' + graph_4;
} else {
window.location.href = window.location.href.substring(0, window.location.href.indexOf("&graph_1=")) + "&graph_1=" + graph_1 + '&graph_2=' + graph_2 + '&graph_3=' + graph_3 + '&graph_4=' + graph_4;
}
});
This works just fine when I have Edit mode open. It does not work, however, if I close Edit mode, or log out. Is there some security setting that I need to disable to allow the page to be refreshed? Also, is there any alternative way that I could add query parameters to the current URL?