1 | // ******************************************************************************** |
---|
2 | // Aplicación WEB: ogAdmWebCon |
---|
3 | // Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla |
---|
4 | // Fecha Creación: Año 2009-2010 |
---|
5 | // Fecha Última modificación: Agosto-2010 |
---|
6 | // Nombre del fichero: consolaremota.php |
---|
7 | // Descripción : Clase para llamar páginas web usando metodología AJAX |
---|
8 | // ********************************************************************************
|
---|
9 | var _url;
|
---|
10 | var _fun;
|
---|
11 | var oXMLHttpRequest;
|
---|
12 | //____________________________________________________________________________
|
---|
13 | //
|
---|
14 | // LLama a la página
|
---|
15 | //
|
---|
16 | // Parámetros:
|
---|
17 | //
|
---|
18 | // url // Url de la página a la que se llama
|
---|
19 | // fun // Función a la que se llama despues de descargarse la página
|
---|
20 | //____________________________________________________________________________
|
---|
21 | function CallPage(url,prm,fun,met){ |
---|
22 | _url=url;
|
---|
23 | _fun=fun; |
---|
24 |
|
---|
25 | if (window.XMLHttpRequest) {
|
---|
26 | oXMLHttpRequest= new XMLHttpRequest();
|
---|
27 | oXMLHttpRequest.onreadystatechange = procesaoXMLHttpRequest;
|
---|
28 | oXMLHttpRequest.open("POST",_url, true); |
---|
29 | oXMLHttpRequest.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
|
---|
30 | oXMLHttpRequest.send(prm);
|
---|
31 | } else if (window.ActiveXObject) {
|
---|
32 | isIE = true;
|
---|
33 | try {
|
---|
34 | oXMLHttpRequest= new ActiveXObject("Msxml2.XMLHTTP");
|
---|
35 | } catch (e) {
|
---|
36 | try {
|
---|
37 | oXMLHttpRequest= new ActiveXObject("Microsoft.XMLHTTP");
|
---|
38 | } catch (E) {
|
---|
39 | oXMLHttpRequest= false;
|
---|
40 | }
|
---|
41 | }
|
---|
42 | if (oXMLHttpRequest) {
|
---|
43 | oXMLHttpRequest.onreadystatechange =procesaoXMLHttpRequest;
|
---|
44 | oXMLHttpRequest.open("POST",_url, true); |
---|
45 | oXMLHttpRequest.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
|
---|
46 | oXMLHttpRequest.send(prm);
|
---|
47 | }
|
---|
48 | }
|
---|
49 | }
|
---|
50 | //_____________________________________________________________________________________
|
---|
51 | function procesaoXMLHttpRequest(){ |
---|
52 | if (oXMLHttpRequest.readyState == 4) {
|
---|
53 | if (oXMLHttpRequest.status == 200) {
|
---|
54 | var fcbk=_fun+"(oXMLHttpRequest.responseText)"; |
---|
55 | eval(fcbk)
|
---|
56 | }
|
---|
57 | }
|
---|
58 | } |
---|
59 | |
---|