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.
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.
Share Improve this question asked Jan 29, 2013 at 19:23 chespinozachespinoza 2,6681 gold badge25 silver badges47 bronze badges1 Answer
Reset to default 7Without any jQuery at all: encodeURIComponent()
.
With jQuery, assuming you're using something like $.get()
:
$.get('http://example./', {foo: '( 3.141516, 3.1415), 3,1415'}, callback);
and jQuery will automagically do the URL-encoding for you.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744368831a4570844.html
评论列表(0条)