javascript - 400 bad request appears in Ajax request background
大家讲道理
大家讲道理 2017-05-17 10:09:27
0
2
892

The problem is solved: It is found that the select data is a string array type by default, so when passing parameters in ajax, use data:{"selectVal":selectVal[0]}This form;
----------------------------------The following is the original question---------- -----------------------
Send data to the background through ajax. I wrote a search box function before, which is usable, but now I have to do it There is a problem when the function of this drop-down option is used.
The implementation goal is: after selecting a certain type, the background response returns the corresponding JSON format object collection;

JS:


controller layer:

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
阿神

For json, the key also needs to be in quotes, like this:

data:{"selectVal":selectVal},

But I’m not sure if this is the reason

Peter_Zhu

http status 400: 1. The semantics are incorrect and the current request cannot be understood by the server. 2. The request parameters are incorrect.
Check your parameters and the logic in the background code

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!