Reputation: 2658
I need serialize a string to a standard URL-encoded notation my string has some blank spaces and parentheses:
string = "( 3.141516, 3.1415), 3,1415";
and I need get it at serverside as a only value - var, how can I do that in order to sent it as a query string???
Thanks in advance.
Upvotes: 2
Views: 5365
Reputation: 359876
Without any jQuery at all: encodeURIComponent()
.
With jQuery, assuming you're using something like $.get()
:
$.get('http://example.com/', {foo: '( 3.141516, 3.1415), 3,1415'}, callback);
and jQuery will automagically do the URL-encoding for you.
Upvotes: 7