jQuery ajax doesnt work in IE

kneidels
kneidels used Ask the Experts™
on

i have a set of select fields, which when selected, send a value via ajax, to return a sub-selection for further choice. I have 3 levels of sub-categories like this.
For some reason it works in FF only - not IE.

LINK: http://bit.ly/ciIxoH 

any ides appreciated!

thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Michel PlungjanIT Expert
Top Expert 2009

Commented:
Very good question because if I use the url produced, it does work...

Have a check with ieHTTPheader

Author

Commented:
weird, it looks fine:

POST /includes/getSubcats2.asp HTTP/1.1
x-requested-with: XMLHttpRequest
Accept-Language: en-us
Referer: http://hakotel.org.il/test/sub2.asp
Accept: */*
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0;  Embedded Web Browser from: http://bsalsa.com/; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Host: hakotel.org.il
Content-Length: 21
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: __utma=193718068.1829591167.1276148815.1276148815.1276148815.1; __utmz=193718068.1276148815.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=hakotel.org.il; ASPSESSIONIDASACRBDC=KMJBCPGBONIIGEICCIPCKBOP

fld=x_file_cat1&val=1

HTTP/1.1 200 OK
Date: Tue, 06 Jul 2010 11:59:21 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
pragma: no-cache
cache-control: private, no-cache, no-store, must-revalidate
Content-Length: 805
Content-Type: text/html; Charset=1255
Expires: Mon, 05 Jul 2010 11:59:20 GMT
Cache-control: private
Michel PlungjanIT Expert
Top Expert 2009

Commented:
not compared to what I get when I call

http://........../includes/getSubcats2.asp?fld=x_file_cat1&val=1
directly from the location bar
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

Author

Commented:
really? i get a clean 200 message when i load it
what do you get?
Michel PlungjanIT Expert
Top Expert 2009

Commented:
I get this

POST http: //hakotel.org.il/includes/getSubcats2.asp HTTP/1.1
x-requested-with: XMLHttpRequest
Accept-Language: de,fr;q=0.7,en;q=0.3
Referer: http://hakotel.org.il/test/sub2.asp
Accept: */*
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.1)
Host: hakotel.org.il
Content-Length: 21
Proxy-Connection: Keep-Alive
Pragma: no-cache
Cookie: ASPSESSIONIDASACRBDC=IOJBCPGBIJCFLCMBNBLGJMCC

fld=x_file_cat1&val=1

HTTP/1.1 200 OK
Date: Tue, 06 Jul 2010 13:06:10 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
pragma: no-cache
cache-control: private, no-cache, no-store, must-revalidate
Content-Type: text/html; Charset=1255
Expires: Mon, 05 Jul 2010 13:06:10 GMT
Cache-control: private
Content-Length: 805
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
Age: 0



-----------------------------------


but if I GET from the location bar, I get this AND the html that contains the dropdown




GET http: //hakotel.org.il/includes/getSubcats2.asp?fld=x_file_cat1&val=1 HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: de,fr;q=0.7,en;q=0.3
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.1)
Accept-Encoding: gzip, deflate
Proxy-Connection: Keep-Alive
Host: hakotel.org.il
Cookie: ASPSESSIONIDASACRBDC=IOJBCPGBIJCFLCMBNBLGJMCC

HTTP/1.1 200 OK
Date: Tue, 06 Jul 2010 13:06:36 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
pragma: no-cache
cache-control: private, no-cache, no-store, must-revalidate
Content-Type: text/html; Charset=1255
Expires: Mon, 05 Jul 2010 13:06:36 GMT
Cache-control: private
Content-Length: 805
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
Age: 0


CONNECT urs.microsoft.com: 443 HTTP/1.0
User-Agent: VCSoapClient
Host: urs.microsoft.com:443
Content-Length: 0
Proxy-Connection: Keep-Alive
Pragma: no-cache

HTTP/1.1 200 Connection established


CONNECT urs.microsoft.com: 443 HTTP/1.0
User-Agent: VCSoapClient
Host: urs.microsoft.com:443
Content-Length: 0
Proxy-Connection: Keep-Alive
Pragma: no-cache

HTTP/1.1 200 Connection established

POST /urs.asmx?MSURS-Client-Key=/x48Zc/6X9osOe4nKDoujg%3d%3d&MSURS-Patented-Lock=iztQW2pGIS8%3d HTTP/1.1
Accept: text/*
SOAPAction: "http://Microsoft.STS.STSWeb/RepLookup"
Content-Type: text/xml; charset=utf-8
User-Agent: VCSoapClient
Host: urs.microsoft.com
Content-Length: 746
Cache-Control: no-cache

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><soap:Body><RepLookup xmlns="http://Microsoft.STS.STSWeb/"><G>{2CEDBFBC-DBA8-43AA-B1FD-CC8E6316E3E2}</G><O>{6C2BDA4A-56C4-4105-9634-3EEB51D49562}</O><P>{EA4A768D-CCFD-4CBB-ADA8-3D46B814E350}</P><D>8.0.6001.9</D><C>8.00.6001.18669</C><S>5.1.2600.3.0</S><I>8.0.6001.18702</I><L>de</L><R xmlns:q1="http://Microsoft.STS.STSWeb/" soapenc:arrayType="q1:Rq[1]"><Rq><T>URL</T><R>http://hakotel.org.il/includes/getsubcats2.asp?fld=x_file_cat1&amp;val=1</R><O>POST</O><W>FRAME</W></Rq></R></RepLookup></soap:Body></soap:Envelope>

HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Content-Length: 500
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Date: Tue, 06 Jul 2010 13:07:28 GMT
Connection: close

POST /urs.asmx?MSURS-Client-Key=FxOu/5NAFjL/FqFVdfFy/w%3d%3d&MSURS-Patented-Lock=cd7ncxO1Ql8%3d HTTP/1.1
Accept: text/*
SOAPAction: "http://Microsoft.STS.STSWeb/RepLookup"
Content-Type: text/xml; charset=utf-8
User-Agent: VCSoapClient
Host: urs.microsoft.com
Content-Length: 745
Cache-Control: no-cache

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><soap:Body><RepLookup xmlns="http://Microsoft.STS.STSWeb/"><G>{2CEDBFBC-DBA8-43AA-B1FD-CC8E6316E3E2}</G><O>{6C2BDA4A-56C4-4105-9634-3EEB51D49562}</O><P>{EA4A768D-CCFD-4CBB-ADA8-3D46B814E350}</P><D>8.0.6001.9</D><C>8.00.6001.18669</C><S>5.1.2600.3.0</S><I>8.0.6001.18702</I><L>de</L><R xmlns:q1="http://Microsoft.STS.STSWeb/" soapenc:arrayType="q1:Rq[1]"><Rq><T>URL</T><R>http://hakotel.org.il/includes/getsubcats2.asp?fld=x_file_cat1&amp;val=1</R><O>PRE</O><W>FRAME</W></Rq></R></RepLookup></soap:Body></soap:Envelope>

HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Content-Length: 500
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Date: Tue, 06 Jul 2010 13:07:28 GMT
Connection: close


GET http: //hakotel.org.il/test/sub2.asp HTTP/1.1
Accept: */*
Accept-Language: de,fr;q=0.7,en;q=0.3
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.1)
Accept-Encoding: gzip, deflate
Proxy-Connection: Keep-Alive
Host: hakotel.org.il
Cookie: ASPSESSIONIDASACRBDC=IOJBCPGBIJCFLCMBNBLGJMCC

HTTP/1.1 200 OK
Date: Tue, 06 Jul 2010 13:16:00 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
pragma: no-cache
cache-control: private, no-cache, no-store, must-revalidate
Content-Type: text/html
Expires: Mon, 05 Jul 2010 13:16:00 GMT
Cache-control: private
Content-Length: 2674
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
Age: 1

Open in new window

Author

Commented:
and whats wrong with that - you get a 200 message, no?
Michel PlungjanIT Expert
Top Expert 2009

Commented:
BUt it seems I get no DATA unless I do a GEt

Can you change the post to a get?

Author

Commented:
i tried a GET, but don't see anything different.
Michel PlungjanIT Expert
Top Expert 2009

Commented:
Sorry, then I am out of ideas - you need to do some deeper debugging

Author

Commented:
Thanks mate.

maybe someone else will still jump in here.
Robb HillSenior .Net Full Stack Developer

Commented:
ok on my end...is it your firefox?  
Consultant & Challenge Subduer
Top Expert 2009
Commented:
It looks like the success callback function is never getting called in IE. Try specifying an error handler and see if that gets called in IE.
$.ajax({
			type: "GET",
			url: "/includes/getSubcats2.asp",
			data: dataString,
			success: function(data) {
				alert(data);
				$(data).insertAfter(selectElement);
			},
			error: function(obj,msg) {
				alert('*** Error! ***\n\n'+msg);
			}
		});

Open in new window

Author

Commented:
Thanks Kravmir.

i get this in IE:

"Error! parsererror"

does this mean anything to you?

Author

Commented:
wow, so after looking around for 'parsererror', i saw it mostly reflected an issue with charset.
and then i found it -

I had an error in my included file.

instead of:

   1. response.ContentType = "text/html"
   2. response.Charset = 1255

i should have had:

   1. response.ContentType = "text/html"
   2. response.Charset = "windows-1255"


and that solved it.
thanks!

Author

Commented:
my own answer details the exact solution, whereas Kravmir pointed me in the right direction - hence he gets the points.
David S.Consultant & Challenge Subduer
Top Expert 2009

Commented:
You're welcome.

I suggest that in the future if you post the actual solution it might be better to select your own post as the answer and assign points to expert posts that helped you.

Author

Commented:
Thanks again (i did actually post the real solution - see post ID 33149791 above)
David S.Consultant & Challenge Subduer
Top Expert 2009

Commented:
> i did actually post the real solution

Yes, I saw it. I'm actually somewhat surprised that IE was so picky about that. It seems like the kind of thing that it tends to be lax about. Perhaps what I meant would have been clearer if I had said "when" instead of "if".

Author

Commented:
ok, thanks again for the push in the right direction!
Michel PlungjanIT Expert
Top Expert 2009

Commented:
It was actually evident in the headers too :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial