Fajl
kad se direktno pozove iskoči prozor za skidanje ovog excel fajla i sve radi kako treba.
Kad ubacim u priču fajl index.php u kome se nalazi ajax koji poziva ovaj fajl gore naveden, ne dobijam dialog za skidanje fajla već se samo ispiše na stranici ono što bi trebalo da bude u excel fajlu kad se sačuva.
Sadržaj index.php
<!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" dir="ltr" lang="sr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<script type="text/javascript">
var theDIV; // we will set this to an id that actually exists in the page
var http_request = false;
function fromServer()
{
if( http_request.readyState==4 )
{
if( http_request.status==200 )
{
// results from call to the server appear here
// in http_request.responseText;
e = document.getElementById(theDIV);
e.innerHTML = http_request.responseText;
}
else
{
// uncomment next line if you want to show any error messages
//alert('error: ' + http_request.responseText);
}
}
}
function makeRequest(url, parameters)
{
http_request = false;
if( window.XMLHttpRequest )
{
// Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType)
{ http_request.overrideMimeType('text/html');
}
}
else if (window.ActiveXObject)
{ // IE
try
{ http_request = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{ try
{ http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request)
{
// uncomment next line if you want to show any error messages
//alert('Cannot create XMLHTTP instance');
return false;
}
http_request.onreadystatechange = fromServer;
http_request.open('GET', url + parameters, true);
http_request.send(null);
}
</script>
</head>
<body>
<script type="text/javascript">
var url = "excel.php"
theDIV='div_ajax';
qry = "?";
makeRequest(url,qry);
</script>
<div id="div_ajax"></div>
</body>
</html>
U čemu je problem i zašto se ovo dešava?