Without actually testing it (heh) I'm going to start by saying that there's some changes that you need to make to Crockford's JSON script - because that's what may be causing problems for you.
He attaches a function to every single Object - which just blows my mind at how dumb that is. For example, I use his JSON script, but a modified version that behaves more cleanly. You can find my modified version here: http://john.jquery.com/jquery/build/js/json.js To serialize an object you do: Object.toJSON( obj ); To deserialize you do: someString.parseJSON(); Let me know if that change helps you at all. --John On 8/17/06, Mathias Bank <[EMAIL PROTECTED]> wrote: > Hallo, I have tried to use jquery for a current project. To test it, I have > created following code: > > < > html> > <body> > <title>JSON-Test</ > title> > <script language="JavaScript" type= > "text/javascript" src="json.js"></script> > <script > language="JavaScript" type="text/javascript" > src="jquery.js"></script> > <script language= > "JavaScript" type="text/javascript"> > function getFormData() { > var test1 = $("#test1").val(); > var test2 = $("#test2").val(); > > var obj = new Object(); > obj.test1 = test1; > obj.test2 = test2; > > var objString = obj.toJSONString(); > > $.post("json.php", {data: objString}, handleJsonResponse); > return false; > > } > > > function handleJsonResponse(data) { > var obj = data.parseJSON(); > > $("#test1").val(obj.test1); > $("#test2").val(obj.test2); > } > > > $(document).ready(function(){ > > $("#formular").submit(getFormData); > }); > > </script> > > < > body> > <form id="formular" action= > "/projekte/test/json.php" method="post"> > <input type > ="text" name="test1" id= > "test1" /><br /> > <input type > ="text" name="test2" id= > "test2" /><br /> > <input type > ="submit" name="submit" id= > "submit" value="senden"/> > > </form > > > </body> > </html> > > > I use jquery Rev: 213 (complete) > > When I'm loading the page in Firefox or Internet-Explorer (at different pcs) > > I get the error "Too much recursion" on line 71 (many times), line 104, > 1597. > > Any idea, why this error appears? I use WinXP with current updates. > > Mathias > > > > _______________________________________________ > jQuery mailing list > [email protected] > http://jquery.com/discuss/ > > > -- John Resig http://ejohn.org/ [EMAIL PROTECTED] _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
