how to get id or idt from URL in Ajax. For example i am on web site index.php?id=1 there is a button which load for example h1.php in this file is a function which needs this id parameter. I can't make this script in Ajax work because can't make URL with proper id, can't get this id from current URL. I tried something like this
<script>
$(document).ready(function () {/* activate scroll spy menu */
var iconPrefix = '.fa-';
var id = $(window.location.href).attr('id');
var idt = $(window.location.href).attr('idt');
$(iconPrefix + 'mixcloud').click(ajaxDemo);
///////////////////* Implementation *///////////////////
// Demos
function ajaxDemo() {
var title = 'Znaczniki H1';
var params = {
buttons: [
{ text: 'Close', close: true, style: 'danger' },
{ text: 'New content', close: false, style: 'success', click: ajaxDemo }
],
size: eModal.size.lg,
title: title,
url: 'views/h1.php?id='+id+'&idt='+idt,
};
return eModal
.ajax(params)
.then(function () { alert('Ajax Request complete!!!!', title) });
}
});
</script>