|
Also try using a more advanced method of creating your Http Request Object. Here is one I use: http://bigblue.lambton.on.ca:7015/Paging2/detect.js.txt + http://bigblue.lambton.on.ca:7015/Paging2/xmldom.js.txt Credit goes to Nicholas Zakas, the author of Professional Javascript for Web Development for that script. I use that class all the time without cross browser problems. Here is an example of how to use it. function SomeObject() { this.oXmlDom = new XmlDom(); var that = this; this.oXmlDom.onreadystatechange = function () { if (that.oXmlDom.readyState == 4) { try { var lstNodes = that.oXmlDom.documentElement.selectNodes ('row'); } catch (e) { alert("Invalid XML."); return; } } } this.oXmlDom.load(some_query); } Hope this helps... On 2/12/07, Shane_Cessna@xxxxxxx <Shane_Cessna@xxxxxxx> wrote:
Milan, I'm currently using Firefox 2...I'll give it a whirl... Shane Cessna Senior iSeries Programmer North American Lighting, Inc. 2275 S. Main St. Suite A Paris, IL 61944 Office - 217.465.6600 x7776 Cell - 618.554.4352 "Milan Zdimal" <milanz@xxxxxxxxx> Sent by: web400-bounces@xxxxxxxxxxxx 02/12/2007 02:26 PM Please respond to Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx> To "Web Enabling the AS400 / iSeries" <web400@xxxxxxxxxxxx> cc Subject Re: [WEB400] AJAX troubles... Try to change what triggers the getToolRoute function to a non-input field. For example, change it to: <a href="#" onclick="getToolRoute()">Get Tool Route</a> For some reason some browsers have trouble with this. Let me know if this works... if not I might have some other ideas, but try this first. What browser are you using by the way? Milan On 2/12/07, Shane_Cessna@xxxxxxx <Shane_Cessna@xxxxxxx> wrote: > > All: > > I'm trying to dynamically load a table using AJAX with RPG-CGIDEV2 as the > back-end...and I'm getting a weird error that I don't really understand... > > I have 3 fields on the web page that I'd like the user to fill out > (tproject, lampcode, tooltype)...once all 3 have been filled out, I'd like > to use AJAX to populate the table based on the data entered...2 of the > fields are input boxes with appropriate onBlur events to call getToolRoute > and the 3rd is a dropdown box with an onChange event to call > getToolRoute...here's my AJAX... > > function getXmlHttpRequestObject() { > if (window.XMLHttpRequest) { > return new XMLHttpRequest(); > } else if(window.ActiveXObject) { > return new ActiveXObject("Microsoft.XMLHTTP"); > } else { > alert("Your browser doesn't support AJAX!"); > } > } > > var request = getXmlHttpRequestObject(); > > function getToolRoute() { > if (document.getElementById('tproject').value != "" && > document.getElementById('lampcode').value != "" && > document.getElementById('tooltype').value != "") { > if (request.readyState == 4 || request.readyState == 0) { > var proj = escape(document.getElementById('tproject').value); > var lamp = escape(document.getElementById('lampcode').value); > var ttyp = escape(document.getElementById('tooltype').value); > var type = escape(document.getElementById('type').value); > for (var l = 1; l < 99; l++) { > if ((type == 'T' && (l < 6 || l > 8 || l < 10)) || > (type == 'Y' && (l < 2))) { > for (var s = 1; s <= 6; s++) { > if (request) { > request.open('GET', '/cgi-test/erqajxtrm?proj=' + proj + > '&lamp=' + lamp + '&ttyp=' + ttyp + '&type=' + type + '&lvl=' + l + > '&stp=' + s, true); > request.onreadystatechange = handleRoute(l,s); > request.send(null); > } > } > } > } > } > //request.open('GET', '/cgi-test/erqajxtrm?proj=' + proj + '&lamp=' + > lamp + '&ttyp=' + ttyp + '&type=' + type, true); > //request.onreadystatechange = handleRoute; > //request.send(null); > } > } > > function handleRoute() { > var x = handleRoute.arguments; > var l = x[0]; > var s = x[1]; > if (request.readyState == 4) { > var step = document.getElementById('lvl' + l + 'step' + s); > step.innerHTML = ''; > //var msgs = document.getElementById('messages'); > var str = request.responseText.split("\n"); > if (str != "") { > step.innerHTML = str; > } > } else { > alert(request.statusText); > } > } > > and my html as follows: > > /$routedetail > <tr id="level/%level%/" onMouseOver="this.bgColor='#cddfed';" onMouseOut= > "this.bgColor='#FFFFFF';"> > <td align="center">/%level%/<input type="hidden" name="lvltype" id= > "lvltype" value="/%lvltype%/"></td> > <td align="center"><div id="lvl/%level%/step1">/%step1%/</div></td> > <td align="center"><div id="lvl/%level%/step2">/%step2%/</div></td> > <td align="center"><div id="lvl/%level%/step3">/%step3%/</div></td> > <td align="center"><div id="lvl/%level%/step4">/%step4%/</div></td> > <td align="center"><div id="lvl/%level%/step5">/%step5%/</div></td> > <td align="center"><div id="lvl/%level%/step6">/%step6%/</div></td> > </tr> > > here's the error I'm getting: > > uncaught exception: [Exception... "Component returned failure code: > 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.statusText]" > nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: > http://nal820.nal.com:81/eReqstest/javascript/ajaxroutem.js :: handleRoute > :: line 54" data: no] > > my RPG if helpful: > > h bnddir('CGITEST/CGIDEV2BND') datfmt(*USA) timfmt(*HMS) > h bnddir('QC2LE') > ferqrtvar if e k disk extfile('ASCLIB/ERQRTVAR') > > //-------------------------------------------------------------------- > // Prototypes > > //-------------------------------------------------------------------- > /copy cgidev2/qrpglesrc,prototypeb > /copy cgidev2/qrpglesrc,variables3 > /copy cgidev2/qrpglesrc,usec > d init pr > d tobrowser pr extproc('QtmhWrStout') > d data like(outxml) > d length 10i 0 const > d error like(gerror) > d getApprover pr 32767a > /copy qrpglesrc,#funcproto > > //-------------------------------------------------------------------- > // Data Structures > > //-------------------------------------------------------------------- > d gerror ds qualified > d bytesp 10i 0 inz(56) > d bytesa 10i 0 > d msgid 7 > d reserved 1 > d data 40 > > //-------------------------------------------------------------------- > // Global Variables > > //-------------------------------------------------------------------- > d path s 1024a inz > d proj s 20a inz > d lamp s 20a inz > d ttyp s 20a inz > d type s 1a inz > d lvl s 2p 0 inz > d stp s 2p 0 inz > d outxml s 32767a > /copy qrpglesrc,#constants > > //-------------------------------------------------------------------- > // main > > //-------------------------------------------------------------------- > /free > init(); > outxml = 'Content-Type: text/html;' + x'1515' + > getApprover(); > tobrowser(outxml : %len(%trim(outxml)) : gerror); > return; > /end-free > > //-------------------------------------------------------------------- > // init > > //-------------------------------------------------------------------- > pinit b > d pi > /copy qcopysrc,prolog3 > /free > proj = zhbgetvar('proj'); > lamp = zhbgetvar('lamp'); > ttyp = zhbgetvar('ttyp'); > type = zhbgetvar('type'); > lvl = %dec(zhbgetvar('lvl'):2:0); > stp = %dec(zhbgetvar('stp'):2:0); > /end-free > pinit e > > //-------------------------------------------------------------------- > // getErrorMsg > > //-------------------------------------------------------------------- > pgetApprover b > d pi 32767a > d string s 32767a inz('<br>') > /free > chain (type:proj:lamp:ttyp:' ':lvl:stp) erqrtvar; > if %found(erqrtvar); > string = getName(rvuser); > endif; > return string; > /end-free > pgetApprover e > > If anyone would be gracious enough to help me, I'd really appreciate it... > > Shane Cessna > Senior iSeries Programmer > North American Lighting, Inc. > 2275 S. Main St. Suite A > Paris, IL 61944 > Office - 217.465.6600 x7776 > Cell - 618.554.4352 > -- > This is the Web Enabling the AS400 / iSeries (WEB400) mailing list > To post a message email: WEB400@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/web400 > or email: WEB400-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/web400. > > > -- Home Office: (519) 541-1905 Cellular: (519) 490-0036 MSN: milanz@xxxxxxxxx -- This is the Web Enabling the AS400 / iSeries (WEB400) mailing list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/web400 or email: WEB400-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/web400. -- This is the Web Enabling the AS400 / iSeries (WEB400) mailing list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/web400 or email: WEB400-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/web400.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.