移动端的搜索用的是from提交
html部分
<form action="javascript:searchSubmit();">
<input type="search" id="searchKey" name="searchKey" placeholder="输入关键字" />
</form>
js部分
function searchSubmit() {
if($.trim($('#searchKey').val()) != "") {
var data = {
//data数据
};
$.ajax({
data: JSON.stringify(data),
contentType:'application/json',
type: "POST",
url: "请求地址",
dataType: "json",
success: function(rest) {
console.log(rest)
}
});
};
}