PHP / jQuery传递回车似乎破坏了jQuery

jQuery front end, php/mySql back end... I'm passing in a text area - scrubbing it for htmlspecialchars() and doing mysql_real_escape_string() everything goes in fine, but when I try to pull it out and 'edit' it in the same form, the jQuery ceases to work - to the point where the modal window wont even pop up...

everything works as expected - UNTIL i put a carriage return in the text area....

I'm using this js to populate the form fields...

// loop and populate - must have matching field names to key names
$.each( data, function( key, value ) {
    $( '#' + key ).val( value );
}); 

I'm using a JSON call to populate the edit form...and the JSON is coming back with the carriage return... so the issue isn't on the back end...

JSON

{ "id":"12", "for_customer_id":"18","customer_id":"20", "engagement_label":"", "part_number":"asdwew", "part_description":"wwe wew  wew", "defect_description":" asd asd asd asd as ", "notification_date":"01/01/2013", "notification_timeCTZ":"3pm", "emp_training_on_file":"Yes", "work_instructions":"hhhllkjijj asd  asd  a sd a
new row", "supervisor_id":"25", "start_date":"", "end_date":"", "date_completed":"" }

"work instructions" - where it says 'new row' is right after CR.

what am I missing??? THX

I may have chosen the "wrong" way to do this - but I decided to do it on the server in PHP... however even though I'm replacing chrs correctly, JSON still seems to have a problem consuming.... where can I find the needed info for JSON and carriage returns... HELP! thx.

MY PHP putting to the db is scrubbed...based on some reading - I've tried 1,2 and 3 slashes () (this is a function to format the string before it gets to the SQL statement)

function parse( $text ){
$parsedText = str_replace( chr(10), '', $parsedText );
return str_replace( chr(13), '\\
', $parsedText );
}

MY PHP coming out - again based on some reading... I'm making my own JSON due to a specific data structure needed... (this is a function to format the string before it gets put in the JSON)

function parseString( $string ) {//function to make JSON CR and the like suitable for comsumption 
$string = str_replace( '\\', '\\\\', $string );
$string = str_replace( '/', '\\/', $string );
$string = str_replace( '"', '\\'.'"', $string );
$string = str_replace( '\b', '\\b', $string );
$string = str_replace( '\t', '\\t', $string );
$string = str_replace( '
', '\
', $string );
$string = str_replace( '\f', '\\f', $string );
$string = str_replace( '', '\', $string );
$string = str_replace( '\u', '\\u', $string );
return $string;
}