473,385 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

null or not an object in IE

9
I have developed a webapp that works very good on firefox and opera, but on IE I keep getting an error message.

I use AJAX to communicate with a PHP file that queries a MySQL database and returns the information in JSON.
Expand|Select|Wrap|Line Numbers
  1. function sendQuerystring2(url,mod,columna)
  2. {
  3.     http2.open("GET", url, true);
  4.     if (mod == "tabla") {
  5.         http2.onreadystatechange = function (){
  6.             if (http2.readyState == 4) {
  7.                 hide('cargando');
  8.                 if (http2.status == 200) {
  9.                     obj_detalle = eval('(' + http2.responseText + ')');
  10.                     crear_tabla(columna);
  11.                 }
  12.             } else {
  13.                 show('cargando');
  14.             }
  15.         }    
  16.     }
Expand|Select|Wrap|Line Numbers
  1. {"items":[{"id":"1","titulo":"Prueba"}]}
obj_detalle['items'][0].id, is "null or not an object" in IE, while in firefox works perfectly.

I have tried an alert(http2.responseText) and it has the correct content.

does anyone know a fix to this?
many thanks.
Apr 3 '07 #1
4 2902
iam_clint
1,208 Expert 1GB
why are you using eval?
Apr 3 '07 #2
macaco
9
why are you using eval?
because it's the way to use JSON. it turns the sent string into a javascript object.

I have also tried with POST instead of GET.. but still getting the same results.
Apr 3 '07 #3
iam_clint
1,208 Expert 1GB
i guess i don't understand why a string needs to be an object?
Apr 3 '07 #4
macaco
9
because it's not only this:

{"items":[{"id":"1","titulo":"Prueba"}]}

there are many items with many other "properties". and I think this is the best way to parse this information. something similar to XML in a way. I can access any property like this:

obj_detalle.items[itemNumber].property

though I it is not working on IE.
Apr 3 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: RMD | last post by:
I need to be able to keep a list of object references, and null them out one by one at a later point in time. I realize this can be dangerous, but I have my reasons. I can't figure out, however,...
99
by: Mikhail Teterin | last post by:
Hello! Consider the following simple accessor function: typedef struct { int i; char name; } MY_TYPE; const char *
5
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream...
2
by: Jongmin | last post by:
Hi, I have made two classes, which are simple and almost same, T_A and T_B. T_A has a static method overloaded to "==". T_B dosn't. And, I run the following code. I expect both "a" and "b"...
64
by: yossi.kreinin | last post by:
Hi! There is a system where 0x0 is a valid address, but 0xffffffff isn't. How can null pointers be treated by a compiler (besides the typical "solution" of still using 0x0 for "null")? -...
3
by: toton | last post by:
Hi, In some cases when my function returns, I need to return a object of null state. This is when I return object by value. (Just like for by pointer, I can return a null pointer ). It has to be...
46
by: lovecreatesbea... | last post by:
Do you prefer malloc or calloc? p = malloc(size); Which of the following two is right to get same storage same as the above call? p = calloc(1, size); p = calloc(size, 1);
11
by: MikeT | last post by:
This may sound very elementary, but can you trap when your object is set to null within the object? I have created a class that registers an event from an object passed in the constructor. When...
9
by: Francois Grieu | last post by:
When running the following code under MinGW, I get realloc(p,0) returned NULL Is that a non-conformance? TIA, Francois Grieu #include <stdio.h> #include <stdlib.h>
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.