Dynadot

[Resolved] Serialize Javascript

Spaceship Spaceship
Watch
Impact
16
Serialize javascript

Fixed, seems IE didn't like me assigning with the variable data :-S
Had another error later on with indexOf on an array.. for anyone searching, despite indexOf being around since 1998 IE has never implementated it, to make it work you have to add this to your functions list:
https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference:Objects:Array:indexOf


I'm creating a new user interface for a site i'm working on, i'm using the following functions to serialize javascript arrays and put them in cookies, (by using serialize i can also pass it straight on to PHP)
http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_serialize/
http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_unserialize/

However if my cookie has:
Code:
a:1:{i:0;s:429:"a:10:{s:5:"Title";s:27:"Phantom Planet - California";s:5:"Added";s:10:"1 Year Ago";s:4:"From";s:15:"phantomplanetTV";s:5:"Views";s:9:"2,000,319";s:8:"Duration";s:5:"03:11";s:8:"Category";s:5:"Music";s:5:"Thumb";s:39:"http://i.ytimg.com/vi/oNRs0RM3EEE/2.jpg";s:9:"PlayerURL";s:42:"http://www.youtube.com/watch?v=oNRs0RM3EEE";s:3:"Key";s:32:"9e827207b86fe3394c3c7f9ecba3c309";s:7:"Tracker";s:32:"9e827307b86fe3974c3c7f9ecba3c309";}";}

I get a strange error in IE, using
Code:
var conv_queuedexisting = unserialize(readCookie('conv_queued'));
alert(unserialize(conv_queuedexisting[0]))
Works fine and it comes up as an object, but as soon as I assign it a variable
Code:
data = unserialize(conv_queuedexisting[0])

It tells me that i cannot use that method or property with that function!

Any idea guys?! (Works fine in FF)
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back