Current File : /home/pacjaorg/public_html/km/plugins/system/djclassifiedsyt/assets/js/script.js |
document.onreadystatechange = function () {
if (document.readyState == "interactive") {
// Load ask author fields
document.querySelectorAll('form.djcf-contact-form').forEach(function (contactForm) {
console.log(contactForm);
var item_id = contactForm.querySelector('[name="item_id"]').value;
var http = new XMLHttpRequest();
var url = 'index.php';
const data = {
option: 'com_djclassifieds',
'view' : 'item',
'task' : 'getAskFields',
'id' : item_id
};
const params = new URLSearchParams(data).toString();
http.open('POST', url, true);
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
contactForm.querySelector('.ask_ex_fields').innerHTML = http.responseText;
var JTooltips = new Tips($$('.Tips1'), {
showDelay: 200, hideDelay: 200, className: 'djcf_label', fixed: false
});
var calendars = jQuery('#ask_ex_fields').find('.field-calendar');
if (calendars.length > 0) {
calendars.each(function(){
JoomlaCalendar.init(jQuery(this)[0]);
});
}
document.formvalidator.attachToForm(contactForm);
}
}
http.send(params);
})
}
}