Reputation: 1623
I have HTML string like as bellow
<span style="font-weight:bold; color:red;"> Hello </span>
I want to pass it as JSONP request so server can parse it easily. like
../save/question?id=5&code="<span style="font-weight:bold; color:red;"> Hello </span>"&callback=123213
but server cant parse properly because of semicolon in string. Any solution for this so When i retrive data from server i got complete HTML string with styling.?
Upvotes: 0
Views: 1948
Reputation: 59637
The semicolon and colon are both reserved characters in URLs, and so must be escaped.
Construct your query string and then pass it through javascript encodeURIComponent
before adding it to your request.
Upvotes: 3