Skip to content

Instantly share code, notes, and snippets.

@ruter
Last active March 27, 2018 02:50
Show Gist options
  • Save ruter/9b05f0f0ce845e044d99a53c7b784eb1 to your computer and use it in GitHub Desktop.
Save ruter/9b05f0f0ce845e044d99a53c7b784eb1 to your computer and use it in GitHub Desktop.
使用 jQuery 的 param() 方法创建数组或对象的序列化表示,该序列化值可在进行请求时在 URL 查询字符串中使用,可避免如 '#' 和 '%' 等特殊字符的出现可能导致的问题 #JavaScript #jQuery
var params = {name: 'Lucy', addr: 'Street#233'}
var res = $.param(params)
console.log(res) // name=Lucy&addr=Street%23233
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment