Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-02-2012, 06:29 PM   PM User | #1
miranda
Senior Coder

 
Join Date: Dec 2002
Location: Arlington, Texas USA
Posts: 1,062
Thanks: 4
Thanked 8 Times in 8 Posts
miranda is an unknown quantity at this point
works in IE not in other browsers

I have a page that has two drop down lists. The first list is somewhat static. I have placed onChange event in this dropdown to trigger an Ajax call to load values into the 2nd dropdown that is dynamically produced via asp script. This must be done via server side script because the values are different for different people and these values can change

This works great in IE. Other browsers only allow for 1st change to refill the
2nd dropdown. Any subsequent changes to the first dropdown produce no results.

Here is the 1st drop down list as I have it right now
Code:
<select name="JobFam" size="1" onChange="JobList(this.value,'AT45AT','N','SBSECA');">
	<option value="Admin">Administrative</option>
	<option value="Artistic">Artistic/Advertising</option>
	<option value="College">College</option>
	<option value="Cosmetology">Cosmetology</option>
	<option value="Custom" Selected>Custom</option>
	<option value="DirecttoWork">Direct to Work</option>
	<option value="ZZZ">Equipment Dealer Jobs</option>
	<option value="Generic">Generic</option>
	<option value="HRS">HR Jobs</option>
	<option value="Indust">Industrial</option>
	<option value="Mngt">Management</option>
	<option value="Mech">Mechanical</option>
	<option value="Medical">Medical</option>
	<option value="Prof">Professional</option>
	<option value="Restaurant">Restaurant</option>
	<option value="Sales">Sales</option>
	<option value="Scien">Scientific</option>
	<option value="Service">Services</option>
	<option value="Social">Social Services</option>
	<option value="Techno">Technological</option>
	<option value="Trades">Trades & Vocational</option>
</select>
Here is the javascript function
Code:
function JobList(str, sMaster, sCFM, sSec){
	var xmlHttp;
	if (navigator.userAgent.indexOf("MSIE")>=0){
		var strName="Msxml2.XMLHTTP";
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0){
			strName="Microsoft.XMLHTTP";
		}
		try{
			xmlHttp = new ActiveXObject(strName);
		}
		catch(e){
			//alert("Error. Scripting for ActiveX might be disabled")
			return e
		}
	}
	else if(window.XMLHttpRequest){
		xmlHttp = new XMLHttpRequest();
	}
	var url="GetJobs.asp";
	var params = "db="+str+"&master="+sMaster+"&sec="+sSec+"&cfm="+sCFM;
	//alert(params)
	xmlHttp.open("POST", url , true)
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.onreadystatechange = function() {  
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
			document.getElementById("jobs").innerHTML=xmlHttp.responseText
		} 
	}
	xmlHttp.send(params)	
}
The Error console in Firefox will tell me the following
Error: JobList is not a function


AS we can clearly see it is indeed a function

in Chrome if I run firebug I can only see this the very first time
POST GetJobs.asp
200 OK
154ms

If I clear the console then I see nothing (it is like the onchange event is not being triggered)


Any ideas what I need to do?

BTW this is done in Ajax because a database holds the values for the 2nd drop down and these are different for different users and there are thousands of users (hundreds of thousands of different values)

Last edited by miranda; 04-02-2012 at 06:49 PM..
miranda is offline   Reply With Quote
Old 04-02-2012, 07:10 PM   PM User | #2
DaveyErwin
Regular Coder

 
Join Date: Aug 2010
Posts: 810
Thanks: 12
Thanked 168 Times in 166 Posts
DaveyErwin is on a distinguished road
I don't see anything
that would cause the
problems you sescribe ?

Maybe problem is
somewhere else ?
DaveyErwin is offline   Reply With Quote
Old 04-02-2012, 09:13 PM   PM User | #3
miranda
Senior Coder

 
Join Date: Dec 2002
Location: Arlington, Texas USA
Posts: 1,062
Thanks: 4
Thanked 8 Times in 8 Posts
miranda is an unknown quantity at this point
That is why I posted on here, I don't see anything either.
miranda is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:36 PM.


Advertisement
Log in to turn off these ads.