What I've done in the past... for better speed (because I was loading a
huge drop down). I had the RPG program return the whole <select> with
<option>s then used JS to replace the innerHTML of a table cell.


<body>
<table>
<tr>
<td id="newDD">
</td>
</tr>
</table>
</body>

<script>
document.getElememtById('newDD').innerHTML = ajaxResponse;

// ajaxResponse should look like this...
// <select> <option value="hey">HEY</option>... </select>


</script>

note ajaxResponse is NOT the correct variable. I'll let you figure that
out.



web400-bounces@xxxxxxxxxxxx wrote on 12/31/2008 10:30:59 AM:

I am trying my first AJAX code. I copied most of the JavaScript from a
January 2008 article by Aaron Bartell. I was able to duplicate his code
in
a test program and it worked. I am now trying to make one drop down
selection update another drop down box. My problem is I used Firefox for
debugging my JavaScript, looking for typos extra quotes that sort of
thing. Now it works properly in Firefox (though my html has another issue

there). My problem is I need it to work in IE, It's for internal company
use and that's the browser on everyone's desktop. In IE when I select in
the first drop down the second goes blank. It is updating, but it's not
getting any data. I don't know anyway to debug in IE, Trial and error is
getting really annoying.

The screen is generated using CGIDEV2. and so is the response being sent
back the browser. I do add the heading to the data sent back in the ajax

response. I am just returning html, no XML to build a new set of options
for the <select> grouping.


JavaScript I am using.


<script type="text/javascript">
// setup needed for ajax on diferent browsers
var http = crtReqObj();
function crtReqObj() {
var reqObj;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
reqObj = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
reqObj = new ActiveXObject("Microsoft.XMLHTTP");
}
return reqObj;
}

// get data from billto and update shipto. Use billto as new
default shipto value

function updDropDown(fldName) {

var fld = document.getElementById(fldName);
http.open('get',

'http://lake:1104/cgi-bro/SYG930?

DDMODE=S&DDVIEWNAME=CB01HP&DDFLDNAME=BTCD&DDSELCODE=&DDVARNAME=&DDDEFAULT='

+
fld.value);
http.onreadystatechange = ItmResponse;
http.send(null);
}

function ItmResponse() {
if(http.readyState == 4 && http.status == 200){
var response = http.responseText;

if(response == ' '){
document.getElementById("shipto").innerHTML='No matching Ship to found';
} else{
document.getElementById("shipto").innerHTML=response;
}
}
}

</script>
--
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 thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.