Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (typeof XMLHttpRequest === 'undefined') {
- XMLHttpRequest = function() {
- try {
- return new window.ActiveXObject( "Microsoft.XMLHTTP" );
- } catch(e) {}
- }
- }
- function check1_change(e, elem) {
- var xhr = new XMLHttpRequest();
- xhr.Open('POST', '/скрипт');
- if (typeof xhr.addEventListener != "undefined") {
- xhr.addEventListener('readystatechange', function(event) {
- var evt = event || window.event;
- if (xhr.readyState == 4 && xhr.status == 200) {
- var response = xhr.responseText;
- // Тут будет ответ от сервера в случае успешной обработки
- }
- });
- }
- var postData = '';
- if (elem.checked) {
- postData = 'act=action1&id=' + elem.getAttribute('id');
- } else {
- postData = 'act=action2&id=' + elem.getAttribute('id');
- }
- xhr.send(postData);
- }
Advertisement
Add Comment
Please, Sign In to add comment