Appending a TR to Table Not Formatting Correctly
- by TimNguyenBSM
My PHP script is sending back an array:
$currentStatus = ( isset( $status ) ) ? "1" : "0";
$html = "<tr><td>" . $email . "</td><td>" . ( ( $status->type == 0 ) ? "View Only" : ( ( $status->type == 1 ) ? "View & Mark" : "View, Mark & Edit" ) ) . "</td><td>Invited</td></tr>";
echo json_encode( array( $html, $currentStatus ) );
Then my jquery is appending this to the table:
...
success: function( result ) {
var resultArray = eval( result );
$( "#myTable tr:last").append( resultArray[0] );
...
}
Problem is, when it prints, it prints the following extra marks:
[email protected]<\/td> View Only<\/td> Invited<\/td><\/tr>","1"]
If I only echo the HTML it appends to table just fine, but I cant do that because I need the $currentStatus back too to do something with it.
Thanks!