Firefox should be showing all of those extra items as well.  And you are
getting just an array.  Looping through your data like:

for (var i = 0; i < jsonObj.length; i++) {
  alert(jsonObj[i]);
}

Will work just fine.

The extra properties to the array object don't matter as long as you are
treating your array like an array.  If you do:

for (var i in jsonObj) {
  alert(jsonObj[i]);
}

Then you will not get what you want.

timo wrote:
> why do my arrays have extra methods in IE?
> i guess i know why.. prototype added all these prototypes to Array()
> but how do a get a responseJSON that's just an array?
> it's fine in firefox... can anyone help with this?
> 
> i'm using Ajax.Request to hit a php page the returns json_encode
> arrays of mysql query results.
> 
> it's all good in firefox, i get an array;
> but in IE responseSJON is an object with Array's prototypes
> like this:
> -     transport.responseJSON  {...}   Object
> +     lastIndexOf     {...}   Object
> +     indexOf {...}   Object
> +     toJSON  {...}   Object
> ..... then my stuff down at the bottom....
> +     each    {...}   Object
>       [0]     "assesment"     String
>       [1]     "category"      String
>       [2]     "categoryquestions"     String
>       [3]     "question"      String
>       [4]     "users" String
> 
> here's what i'm doing....
> 
> 
> the php page sets the header content type to application/json, does
> the sql, then does this:
> 
> $jsonStrArray = array();
> while ($record = mysqli_fetch_array($recordSet, MYSQL_ASSOC)) {
>       array_push($jsonStrArray, $record );
> }
> echo json_encode($jsonStrArray);
> 
> 
> it returns things like this:
> [{"id":"1","categoryName":"Primero Catagory"},
> {"id":"2","categoryName":"The 2nd Catagory"},
> {"id":"3","categoryName":"Catagory Threee!!"}]
> 
> 
> i'm getting the responseJSON here
> 
> Ajax.Responders.register({
>         onCreate: function() {
>           Ajax.activeRequestCount++;
>         },
>         onComplete: function(request, transport, json) {
>                          //what was the ajax requseting?
>                       var objectName = request.parameters.objectName;
>                       var jsonObj = transport.responseJSON; //todo:rename. 
> php returns
> array
>                       if (objectName != null && jsonObj != null){
>                               addDataObject(objectName,jsonObj);  // do 
> something with the
> result
>                       }
>                       var x = 0;
>         }
>       });
> 
> > 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to