Created by Jerry Wang, last modified on May 08, 2015
-
启动你本地Eclipse里的YAAS service:
为了方便起见,新建一个批处理文件,内容如下,双击即可执行:
确保service成功启动:
2. 创建一个新的html,source code如下:
<html>
<script src="C:\Users\i042416\Desktop\jquery_1.7.1.js"></script>
<script>
$(document).ready(
function() {
console.log("ready event");
var aj = $.ajax( {
url:"http://localhost:8080/wishlists",
headers:{
"hybris-app" : "jerry_test",
"hybris-tenant" : "cecwishlist"
},
type:'get',
success:function(data) {
console.log("ok");
},
error : function() {
console.log("failed");
}
});
});
</script>
</html>
代码里AJAX输入参数是从API console里取的:
3. API的结果包含在callback的data参数里: