Oto błąd :
Error thrown at line 11, column 8 in ajaxTest() in http://*******/~metis/php.php: client.onreadystatechange = function() called from line 1, column 0 in <anonymous function>(event): ajaxTest()
To moj kod :
$login_ip = "ip servera"; $login_port = "port"; $folder_id = "folder na serverze"; $sessia = "numer sessi"; $filename = "\home\metis\pobrane\plik_do_testu.txt"; $post = folder_id=".$folder_id."&session_nr=".$sessia."& HTTP/1.1 Connection: close User-Agent: ***** Host: ***** Content-Length: ".$filename_len." ".$filename;
<script type="text/javascript"> function ajaxTest() { var client = new XMLHttpRequest(); client.open('POST', "<?php echo $login_ip.":".$login_port."/upload/" ?>", true); client.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); client.send("<?php echo $post ?>"); client.onreadystatechange = function() { if (200 === this.status && 4 === this.readyState) { alert('status: ' + this.statusText + '\n' + this.responseText); } } } </script>