Код: Выделить всё
<SCRIPT src="Добавление сайта в каталог.files/JsHttpRequest.js"></SCRIPT>
<SCRIPT language=JavaScript type=text/javascript>
function doLoad(value) {
// Create new JsHttpRequest object.
var req = new JsHttpRequest();
// Code automatically called on load finishing.
req.onreadystatechange = function() {
if (req.readyState == 4) {
// Write result to page element (_RESULT becomes responseJS).
document.getElementById('pic_cod').innerHTML = req.responseJS.cod;
// Write debug information too (output becomes responseText).
document.getElementById('debug').innerHTML = req.responseText;
}
}
// Enable caching of the query results
req.caching = false;
// Prepare request object (automatically choose GET or POST).
req.open(null, 'ajax_pic.php', true);
// Send data to backend.
req.send( { q: value } );
}
</SCRIPT>