請問要如何把mui.ajax反回的數據加入網頁上
在APP運行, 發生以下錯誤, 請問要如何把mui.ajax反回的數據加入網頁上
Uncaught TypeError: Property 'data' of object function (b,c){if(c=c||a,!b)return j();if("object"==typeof b)return i.isArrayLike(b)?j(i.slice.call(b),null):j([b],null);if("function"==typeof b)return i.ready(b);if("string"==typeof b)try{if(b=b.trim()......on at index2.html:38
function showHint(str) {
if (str.length == 0) {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
var url = 'http://hktc.erufa.com/show.php'
mui.ajax(url,{
data:{
q:str
},
dataType:'html',
type:'get',//HTTP请求类型
timeout:30000,//超时时间设置为10秒;
success:function(data){
//服务器返回响应,根据响应结果,分析是否登录成功;
document.getElementById("txtHint").innerHTML = data;
},
error:function(xhr,type,errorThrown){
//异常处理;
console.log(type);
}
});
Start typing a name in the input field below:
First name:
Suggestions:
php code
header("Access-Control-Allow-Origin:*");
header("Content-type:text/html; charset=utf-8");
$a[] = "Anna";
$a[] = "Brittany";
$a[] = "Cinderella";
$a[] = "Diana";
$a[] = "Eva";
$a[] = "Fiona";
$a[] = "Gunda";
$a[] = "Hege";
$a[] = "Inga";
$a[] = "Johanna";
$a[] = "Kitty";
$a[] = "Linda";
$a[] = "Nina";
$a[] = "Ophelia";
$a[] = "Petunia";
$a[] = "Amanda";
$a[] = "Raquel";
$a[] = "Cindy";
$a[] = "Doris";
$a[] = "Eve";
$a[] = "Evita";
$a[] = "Sunniva";
$a[] = "Tove";
$a[] = "Unni";
$a[] = "Violet";
$a[] = "Liza";
$a[] = "Elizabeth";
$a[] = "Ellen";
$a[] = "Wenche";
$a[] = "Vicky";
// get the q parameter from URL
$q = $_REQUEST["q"];
$hint = "";
// lookup all hints from array if $q is different from ""
if ($q !== "") {
$q = strtolower($q);
$len=strlen($q);
foreach($a as $name) {
if (stristr($q, substr($name, 0, $len))) {
if ($hint === "") {
$hint = $name;
} else {
$hint .= ", $name";
}
}
}
}
// Output "no suggestion" if no hint was found or output correct values
echo $hint === "" ? "no suggestion" : $hint;
?>
相关阅读:
iOS使用xib自定义cell控件为空求大神支招
类似Eclipse,Android Studio等IDE是如何检查代码错误的?
reactjs 事件 项目开发过程 零起点记录
Web.py POST StringIO 用PIL打开
.js页面中文都是乱码怎么回事?
鼠标移入图片 这个效果如何以最少的代码实现?比如只用css可以吗?
CSS关于垂直居中,大家有没有什么比较好的建议。
如果 TCP 网络偶发丢包,那么是对小文件传输影响大?还是对大文件传输影响大?
c++ stl 有没有无重复元素队列这样的容器?
已有的app, 怎么快速支持ipad?
mac外接显示器品种,大小推荐,写代码用
如何让外部网站外链js生成指定html片段并异步更新数据
正则表达式过滤Html信息
获取安装的高德地图包名和类名时报错空指针。
JavaScript中关于重写原型的问题,是如何指向的的?
如何改变navbar中的字体颜色和大小?
SSL证书问题跟进
网站后台权限是在功能开发完后做还是在一开始做比较好?
前台页面需要展示node服务器上的静态资源(图片),如何实现?
Js Uncaught ReferenceError:XXX is not defined