I’ve got this flow on an enterprise application:
- on every service page there is a “search box”. When user starts to type something in it a call to a Struts 2 action in fired (via JQuery autocompleter)
- on action call, Hibernate looks for hints on user search on a MySql database
-
when hints are found a JSON response is given. Something like:
... "map": { "id": "1234", "title": "Title 1", "permalink": "title-1", "class": "contentClassA", "contentType": "Content type ..." }, ... -
back on frontend JSP, some Javascript creates a list ov
<div>, each of them containg the data of amapobject.
Steps 1-4 is working on Firefox up to version 11 and Internet Explorer to version 9. Then via Javascript I try to build a self.location redirect to reload the page discriminating on the class value. And here is the problem. The obj variable contains a single JSON map as stated above, and I do:
var classType;
if(obj['class'] != undefined) {
classType = obj['class'];
} else {
//classType = obj.map.class;
//classType = obj['map'].class;
//classType = obj.class;
// ...
classType = obj.map['class'];
}
Everything is ok on FF, but IE (ver. 7-8-9) falls into the else and the classType variable returned is undefined no matter what I try.
Am I missing something?
I think your issue is with propertyName
"class", which is a reserved keyword in js. Check below link.http://javascript.about.com/library/blreserved.htm
Even I faced similar issue with IE, I simply renamed the key
classtoclassName