我不知道我在这里做错了什么。我正在尝试使用JavaScript对我的URL进行编码。但是URL从未被放入推文中。我认为这与我的URL中的某些参数有空格有关。
如果我从URL中删除%20
,那么它就能正常工作...
但我需要保留那些空格。
这是我现在拥有的javascript代码...
var text = encodeURIComponent("40% Off Prom Tuxedo Rental");
var couponURL = encodeURIComponent("http://example.com/coupon/?ref_name=Test Name&school=Test School");
var twitterURL = "https://twitter.com/intent/tweet?text=";
var twitterURL = twitterURL+text+"&url="+couponURL;