Print Story Forays into JSON
Diary
By hulver (Wed Feb 06, 2008 at 12:01:42 PM EST) (all tags)
With accompanying weirdness.


So, I'm doing some AJAX'y stuff at work. There are the results of a file import, that could be very large. There could also be many of these imported files listed.

Quite a lot really.

My solution is to only show the results for the latest file upload when you first show the screen. All the other uploads are "collapsed", and you have to click a + sign to show the results. Some AJAX'y stuff goes off in the background and fetches the results to display.

Now there are two results to display, and the results page is already HTML, so rather than messing around the XML, I thought I'd use some JSON to pass the results back.

Now comes the weird part.

The results come back fine, I "eval" them (naughty me) and get an object with "TestResults" and "UploadResults". Two big lumps of html.

That's all working fine and dandy.

Now when I go to update my various div's with the results some weirdness occurs.

I'm using the innerHTML property to update the div, because it's easier and faster to update the screen that way. All it is is a simple list like

Record 1 did not import because blah blah blah<br>
Record 5 did not import because ...

However, even though the html is returned complete, stuffing it into the div using innerHTML only displays the first line. Everything after that is hidden.

If I then go off and do the call again, it works. Assigning the same text twice does not.

I'm confused. Anybody seen anything like it.

This is in IE7, the site doesn't work in FireFox (for other reasons to complex to go into here at the moment).

< Day off quickie: Mac questions. | BBC White season: 'Rivers of Blood' >
Forays into JSON | 7 comments (7 topical, 0 hidden) | Trackback
Man, I totally mis-read that title. by blixco (4.00 / 3) #1 Wed Feb 06, 2008 at 12:08:25 PM EST
Thank god it was a mis-read.
---------------------------------
"You bring the weasel, I'll bring the whiskey." - kellnerin


You pervy perv! by greyrat (4.00 / 3) #2 Wed Feb 06, 2008 at 12:25:14 PM EST
I had to read it again to get to where you were...
~
There is absolutely no correlation or causation amongst intelligence, power, talent and wealth.
Kha-Nyou
[ Parent ]

Never had an endoscopy? by ambrosen (4.00 / 1) #5 Wed Feb 06, 2008 at 01:42:25 PM EST
There's worse things

[ Parent ]

debugging in ie7 suxxors, but there is hope: by discordia (4.00 / 1) #3 Wed Feb 06, 2008 at 01:06:00 PM EST
try firebug lite



Dude, thanks by Vertical Frankenstein (4.00 / 1) #4 Wed Feb 06, 2008 at 01:41:16 PM EST


[ Parent ]

My boring two cents by johnny (2.00 / 0) #6 Wed Feb 06, 2008 at 08:42:40 PM EST
  1. IE suxxors (sp?) and you will pay a heavy price for doing AJAX instead of using OpenLaszlo or gosh, even Flex/Adobe. I know that I should be bitter about OpenLaszlo since they laid me off last November, but really, just as Christ died on the cross for our sins so we don't have to go to hell, OpenLaszlo handles all this browser-specific shit so that you don't have to. I know, I know, the fairy-taleness of each of those assertions is an open question. But I still think that anyboby bull-headed enough to roll their own Ajax apps deserves whatever shit (that's shite to you, I guess) they get. If you don't like Laszlo, use Flex. Really. Rolling your own Ajax is like hitting yourself in the head with a hammer. I don't understand why people do it.
  2. Corollary (sp) to (1): you've given away that you know what doors you're opening by using 'eval'.  We'll look for your name in the papers when the $7 billion fraud comes in through your back door. . .
On the other hand, what the fuck do I know?

Good luck in any event!
Buy my books, dammit!


Yes. by hulver (4.00 / 1) #7 Thu Feb 07, 2008 at 04:28:27 AM EST
This isn't hugely involved AJAX though, it's a simple solution to a simple problem. If I was doing a huge slice of development I would use a framework of some sort.

I'm eval'ing at the moment as a quick way while in development, I won't be using that in the finished product.
--
smart, pretty, sane. pick two - georgeha
[ Parent ]

Forays into JSON | 7 comments (7 topical, 0 hidden) | Trackback