:: Forum >>

xmlhttp request?

I would like to populate the grid using a javascript xmlhttp request call to a server-side asp or php script that would handle DB access and send back data as xml.

What must I do to accomplish this with your tool?
Tim
Sunday, January 22, 2006
Look at the /examples/data/grid.asmx - simple web service which produces xml data like in /examples/data/companies-array.xml

This data is used to populate the grid in /examples/old/xml-arrayofrecords.htm
Alex (ActiveWidgets)
Sunday, January 22, 2006
Alex, I hold a commercial license, and am experimenting with v2.

I've spend HOURS trying to get this to work. Perhaps I just can't see the nose on my face and it's really simple. Please have a look and tell me where I might be going wrong.

As far as I can see, all your examples use files or arrays for data... and I'm just too frustrated to continue trying to figure this out on my own.

I am 100% certain that the EMtestDB.asp file returns valid XML data.

I am also 100% certain that the Javascript invoking the xmlHttp object is working fine and receiving the XML.

If I do check the contents of xmlDoc.xml on line 31, I get all the stuff I should get.

The problem is loading it into the table object on line 33. I've tried 100 different ways to do this... and none have worked. Please help.

Thanks in advance...

Tim

Here's my code...

1 var request;
2 var url = 'EMtestDB2.asp';
3 if (window.XMLHttpRequest) {
4 request = new XMLHttpRequest();
5 request.onreadystatechange = processReqChange;
6 request.open("POST", url, true);
7 request.send(null);
8 } else if (window.ActiveXObject) {
9 window.XMLHttpRequest = function() {
10 var a = [ 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP', 'Msxml2.XMLHTTP.3.0'];
11 i = a.length; while(i--) {
12 try {
13 return new ActiveXObject( a[i] );
14 } catch (e) { }
15 }
16 return null;
17 };
18 if( window.XMLHttpRequest ) {
19 request = new XMLHttpRequest();
20 }
21 if (request) {
22 request.onreadystatechange = processReqChange;
23 request.open("POST", url, true);
24 request.send();
25 }
26 }
27
28 function processReqChange() {
29 if (request.readyState == 4) {
30 if (request.status == 200) {
31 xmlDoc=request.responseXML
32 var table=new AW.XML.Table;
33 table.setXML(xmlDoc);
34 var obj = new AW.UI.Grid;
35 obj.setColumnCount(5);
36 obj.setRowCount(5);
37 obj.setCellModel(table);
38 document.write(obj);
39 } else {
40 alert("Problem with XML data:\n" + request.statusText);
41 }
42 }
43}
Tim Milo
Sunday, January 22, 2006

This topic is archived.


Back to support forum

Forum search