i want to encode this text from
2016, Odd Semester, Periode 1
to
2016%2C%20Odd%20Semester%2C%20Periode%201
but i can't encode the comma.
it show like this
2016,%20Odd%20Semester,%20Periode%201
here my code
var Term = '2016, Odd Semester, Periode 1'
encodeURI(Term);
Use encodeURIComponent():
var foo = encodeURIComponent('2016, Odd Semester, Periode 1');
console.log(foo);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With