Takze chel by som toto co som nasiel na webe nejako upravit aby to fungovalo na mojej html stranke
malo by to automaticky nacitat bez reloadu do.php alebo aspon ukazat ze "Loading" a potom presmerovat na do.php
do.php je subor !
javascript:
Kód:
<script type="text/javascript">
<!--
var xmlHttp
function valid(str)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="index.php";
url=url+"?info="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById("content").innerHTML=xmlHttp.responseText;
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
function startUpload(){
document.getElementById('loader').innerHTML = '<p> </p><p> </p>'
+'<center>Validating<br /><img src="index.php?info=img" alt="Loading..." /></center>';
document.getElementById('form').style.visibility = 'hidden';
return true;
}
//-->
</script>
do tohto indexu
Kód:
<!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 transitional//EN" "http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>TEST</title>
</head>
<body style="text-align: center;">
<form action="do.php" method="post" enctype="multipart/form-data">
<p><h2>TEST</h2></p>
<p><input type="file" name="input" size="60" /></p>
<input type="submit" value="Convert"/>
</body>
</html>
shaggy: presunuté, toto súvisí viac s JS/ajaxom ako s html