rare2findd
New Member
here's the thing. I got a text area that is filled with a JSON from a database, it's not formatted as i need to format it later with a formatJSON button.If i use the formatJSON function\[code\]function FormatTextarea() { var sJSON = $("#result_div").val(); if (sJSON.length > 0) { try { var oJSON = JSON.parse(sJSON); if ( $("#SORT").attr("checked") == true ) { oJSON = SortObject(oJSON); } $("#result_div").val( FormatJSON(oJSON) ); } catch(sError) { alert("You are attempting to parse invalid JSON.") } } else { alert("There's no JSON to format."); }}\[/code\]The Json inside the result_div text area is formatted correctly.But now, if i try to get another unformatted JSON from the database and try to put it in result_div textarea, the text area has the older json object on it instead of the new one.Is like no matter what i set to the current text area, the formatted json in there won't change, is like it's "locking" the text area value.I verified everything was being set correctly, and found that if i don't use the FormatTextarea() function to format it, the text area behaves normally. The data returned from the database will be shown correctly in the result_div text area.Does any of you guys know why would this happen?Thanks in advance,Mariano.