Decode encodedURI component

Decode encodedURI component
0

#1

I am facing two problems here:

  1. How do I decode encodedURIComponent while tweeting?
  2. How do I remove HTML tags like <p> using jQuery. I know the remove method. But here the output comes along with the tag while firing the API using jQuery.

Note:- Please click the tweet button. You’ll see that the <p> tags are still there, which come while firing the API, and the special characters aren’t decoded after encodingURICOmponent in jQuery


#2

I’m not sure what you mean here. You’re using encodeURIComponent because you’re making the quote a part of a URL. You don’t have to worry about decoding it; the Twitter API will decode it for you.

Having those tags built-in the response kind of sucks.

You can remove the tags yourself (using String.replace or whatever) before sending it as a tweet. Or you can pick it up directly from the #quote-form element:

encodeURIComponent($('#quote-form').text())