<a href="http://hainantravel.me/maps/hainan_map.html?dadunhgai&yalongbay&h_y">ссылка</a>
var q = window.location.search;
var arr = q.slice(1).split('&');
var i = document.querySelectorAll('input[type="checkbox"]');
i.forEach(function(a) {
arr.forEach(function(b) {
var v = a.getAttribute('value');
if(v == b) {
a.checked = true;
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('a[href^="#"]').on('click',function(e) {
e.preventDefault();
var target = this.hash,
$target = $(target),
$calculus = ( $target.offset().top - 75 ),
$target_to = $calculus.toFixed();
$('html, body').stop().animate({
'scrollTop': ($target_to+'px')
}, 900, 'swing');
});
});
</script>
<form id="form" action="{% url 'documents:print_documents'%}" method="POST" target="_blank">
<input class="select-inv-check" data-id="123" type="checkbox">123
<input class="select-inv-check" data-id="456" type="checkbox">456
<input class="btn btn-sm btn-default print-all-btn" id="printAll" type="submit" name="send" value="Распечатать">
</form>
$( "#form" ).submit(function( event ) {
var id = [];
$('input.select-inv-check:checked').each(function() {
id.push($(this).data('id'));
});
if (id.length != 0) {
id.forEach(function(item, i) {
var elInput = document.createElement("input");
elInput.setAttribute('type', 'hidden');
elInput.setAttribute('name', 'doc_ids[]');
elInput.setAttribute('value', '');
elInput.value = id[i];
$("#form").append(elInput);
});
return;
}
event.preventDefault();
});