Форумы / Cotonti / Support / Ajax URLs - Need help understanding them.

Macik
#38471 13.11.2013 22:53

All Cotinti Ajax helper functions is coded for user actions like click for «ajaxed» link or «ajaxed» form submit.

So better way to implement your function is to write own JS code and bind it to select change event. Something like that (should works only with jQuery and Ajax setting enables in Admin panel):

$('#mySelect').change(function() { 
    ajaxEnabled && ajaxSend({
            method: 'GET',
            url: 'url/to/your/app',
            divId: 'targetBlockID'
        });
});

Or something like this in native JS — should work (but not tested) without jQuery and Ajax enabled settings.

var mySelect = document.getElementById('mySelectBoxId');
mySelect.onchange = function() {
  var xhr = new XMLHttpRequest(); 
    xhr.open('GET', '/url/of/your/app', true); 
    xhr.onreadystatechange = function() {  
      if (xhr.readyState != 4) return; 
      outputElem.innerHTML = xhr.responseText; 
    }
    xhr.send(null); 
}

[By the way - this native code is not actually crossbrowser.]

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F