I’m trying to pass some hex colours to a php script via an GET ajax call. PHP doesn’t seem to like the hex colours though, I’ve tried replacing the # and using encodeURIComponent neither of which work.
here’s the js (with each currentColors entry being a hex color)
var dataString = 'designName=test&mc1='+currentColors[1]+'&mc0='+currentColors[0]+'&sp='+currentColors[2];
var strippedString = encodeURIComponent(dataString);
Use
encodeURIComponentto encode URI components:Example:
On the server-side the query string will yield: