Ajax GET request parameter inexplicable loss problem

Source: Internet
Author: User
GET http://hong.dev.meituan.com/index.php?c=Search&a=associate&q=%20200 OK        24ms    jquery-....min.js (第 4 行)参数头信息响应HTMLCookiesa   associatec   Searchq   

This is the URL address of the Ajax GET request, why when the parameter q is Chinese, the parameter of Q under Firebug is empty? The address has the value Ah, I pass is the Chinese, why will give the code? In fact, this parameter is "milk"

Reply content:

GET http://hong.dev.meituan.com/index.php?c=Search&a=associate&q=%20200 OK        24ms    jquery-....min.js (第 4 行)参数头信息响应HTMLCookiesa   associatec   Searchq   

This is the URL address of the Ajax GET request, why when the parameter q is Chinese, the parameter of Q under Firebug is empty? The address has the value Ah, I pass is the Chinese, why will give the code? In fact, this parameter is "milk"

The address q=%20 is a space, so the following is also a space

So your server received a request in the parameter q is also a space, not Chinese

Let's make sure which link is out of the question.

I think what you need is a encodeuricomponent or encodeURI method to URL-encode the requested address. For details, please refer to
Encode-url-in-javascript

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.