Encoding rendered data for URLs
Encoding rendered data for URLs
philip
Posts: 11Questions: 5Answers: 0
What is the preferred method to encode data for URLs. For example:
"columnDefs": [
"targets": 4,
"render": function ( data, type, full, meta ) {
return '<a href="example.php?data='+data+'&name='+full[2]+'">Example</a>';
}
},
I need to encode full[2] here, and data for the matter, as they may contain characters such as & or ". I blindly attempted full[2].text() to no avail. Perhaps a columnDefs or render option to encode all values? Or nice ways to encode them individually?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Use encodeURIComponent.
Allan