javascript - Serialize string to standard URL-encoded notation - Stack Overflow

I need serialize a string to a standard URL-encoded notationmy string has some blank spaces and parent

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 badges
Add a ment  | 

1 Answer 1

Reset to default 7

Without 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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信