56 lines
2.0 KiB
JavaScript
56 lines
2.0 KiB
JavaScript
|
|
/*
|
||
|
|
* @component SQL 2 Excel Pro Component
|
||
|
|
* @copyright Copyright (C) Joomla-R-Us, joomla-r-us.com
|
||
|
|
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3
|
||
|
|
*/
|
||
|
|
|
||
|
|
var http_request_sql2excel = false;
|
||
|
|
|
||
|
|
function sql2excel_ajax(url, parameters, loading) {
|
||
|
|
|
||
|
|
http_request_sql2excel = false;
|
||
|
|
if (window.XMLHttpRequest) { // Mozilla, Safari,...
|
||
|
|
http_request_sql2excel = new XMLHttpRequest();
|
||
|
|
if (http_request_sql2excel.overrideMimeType) {
|
||
|
|
// set type accordingly to anticipated content type
|
||
|
|
//http_request_sql2excel.overrideMimeType('text/xml');
|
||
|
|
http_request_sql2excel.overrideMimeType('text/html');
|
||
|
|
}
|
||
|
|
} else if (window.ActiveXObject) { // IE
|
||
|
|
try {
|
||
|
|
http_request_sql2excel = new ActiveXObject("Msxml2.XMLHTTP");
|
||
|
|
} catch (e) {
|
||
|
|
try {
|
||
|
|
http_request_sql2excel = new ActiveXObject("Microsoft.XMLHTTP");
|
||
|
|
} catch (e) {}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if (!http_request_sql2excel) {
|
||
|
|
alert('Cannot create XMLHTTP instance');
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
document.getElementById('ajax-tabs-content').innerHTML = loading;
|
||
|
|
|
||
|
|
http_request_sql2excel.onreadystatechange = sql2excel_ajaxCB;
|
||
|
|
http_request_sql2excel.open('POST', url, true);
|
||
|
|
http_request_sql2excel.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||
|
|
http_request_sql2excel.setRequestHeader("Content-length", parameters.length);
|
||
|
|
http_request_sql2excel.setRequestHeader("Connection", "close");
|
||
|
|
http_request_sql2excel.send(parameters);
|
||
|
|
}
|
||
|
|
|
||
|
|
function sql2excel_ajaxCB() {
|
||
|
|
|
||
|
|
|
||
|
|
if (http_request_sql2excel.readyState == 4) {
|
||
|
|
if (http_request_sql2excel.status == 200) {
|
||
|
|
result = http_request_sql2excel.responseText;
|
||
|
|
document.getElementById('ajax-tabs-content').innerHTML = result;
|
||
|
|
} else {
|
||
|
|
alert('There was a problem with the ajax request.');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|