开发者

Ajax request : application/x-www-form-urlencoded params

While adding the parameters to get/post request they need to be encoded in application/x-www-form-urlencoded form. So do we need to encode values ea开发者_高级运维ch time ? Does JavaScript have any method for that ? What are the possible caches ?

On server side when we read the values we do not decode them we directly say Request.Params["key"] and that returns value. Does that mean that they are automatically taken care when we read the values?


Use encodeURIComponent(string); And yes, the values are already decoded for you. Check out this article: http://www.hanselman.com/blog/CommentView.aspx?guid=d5756ece-8c33-4edd-80a7-f403e5fd6a07


You can (and should) use encodeURIComponent() on your values. And yes, the server usually decodes the variables, but you can easily test that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜