Twitter web intent URL encoding not working

I have no idea what I'm doing wrong here. I'm trying to encode my URL with javascript. But the URL never gets put into the tweet. I think it has something to do with some parameters in my URL having spaces.

If I take out the %20's from my URL then it works...

But I need to keep those spaces in there.

This is the javascript code I have right now...

var text =  encodeURIComponent("40% Off Prom Tuxedo Rental");
var couponURL = encodeURIComponent(" Name&school=Test School");
var twitterURL = "";
var twitterURL = twitterURL+text+"&url="+couponURL;


In this situation, a percentage sign equals %25, so if you want to include the spaces in your tweet link, use %2520 instead of %20. So wherever you were going to use %20, use %2520 instead.

var text =  "40% Off Prom Tuxedo Rental";
text = text.replace(/\s/g, "%2520")

Need Your Help

How do I wrap text in a span?

html css internet-explorer word-wrap

I've got a span that's 350 pixels wide. If there's more text than that, it just goes straight out to the right off to the side of the span. How do I force the text to wrap down into a paragraph? I've

validate form with database before moving on to the next page

php validation

I want to validate a form input with my database before allowing a user to go to the next page of a checkout process. So,