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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---