我需要将字符串序列化为标准的URL编码表示法我的字符串有一些空格和括号:
string = "( 3.141516, 3.1415), 3,1415";
Run Code Online (Sandbox Code Playgroud)
我需要在服务器端获取它作为唯一的值 - var,我该怎么做才能将它作为查询字符串发送?
提前致谢.
没有任何jQuery : encodeURIComponent().
使用jQuery,假设您使用的是$.get():
$.get('http://example.com/', {foo: '( 3.141516, 3.1415), 3,1415'}, callback);
Run Code Online (Sandbox Code Playgroud)
并且jQuery将自动为您执行URL编码.
| 归档时间: |
|
| 查看次数: |
5230 次 |
| 最近记录: |