在SAP UI5应用里使用jQuery.ajax读取数据并显示在页面上
2023-09-14 09:02:39 时间
源代码:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
<title>SAPUI5 Sandbox</title>
<script
id="sap-ui-bootstrap"
src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_belize"
data-sap-ui-libs="sap.m,sap.ui.layout"
data-sap-ui-compatVersion="edge"
data-sap-ui-preload="async">
</script>
<script>
sap.ui.getCore().attachInit(function () {
var oInput = new sap.m.Input({
liveChange : function(oEvent) {
console.log('live change event: ' + oEvent.getParameter('newValue'));
}
});
var oVerticalLayout = new sap.ui.layout.VerticalLayout();
oVerticalLayout.addContent(oInput);
var oText = new sap.m.Text();
oVerticalLayout.addContent(oText);
//oText.setText('response');
oVerticalLayout.placeAt("content");
var html = jQuery.ajax({url:"s5.xml",async:false});
oText.setText(html.responseText);
// console.log('response: ' + html.responseText);
});
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
url:http://localhost:3000/wt/livesearch.html
注意,不能本地直接打开livesearch.html, 否则会遇到跨域问题:
Access to XMLHttpRequest at ‘file:///C:/Code/jerrylist/walkthrough/s5.xml’ from origin ‘null’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.
运行时结果:
相关文章
- 关于 SAP UI5 SimpleForm 控件里的 ColumnsL 和 labelSpanXL 的测试
- jquery ajax步骤,jquery ajax(ajax请求的五个步骤jQuery)
- SAP UI5 应用中的 sap.ui.require.toUrl 使用场景
- 关于 SAP UI5 控件内容的 Excel 导出功能,如何加载所需的导出工具库
- SAP UI5 sap.ui.export.Spreadsheet API 介绍
- jquery选择器用法_jQuery属性选择器
- SAP UI5 响应式表格 sap.m.Table 根据不同宽度的屏幕动态决定显示或隐藏 Column 的实现源代码讲解试读版
- SAP Emarsys 的前后台技术栈
- jQuery表单插件jquery.form.js详解编程语言
- SAP 图形页面详解编程语言
- SAP中日期时间函数总结详解编程语言
- SAP 锁机制详解编程语言
- SAP EWM – 物料主数据 – EWM系统一般属性详解编程语言
- SAP学习笔记(MM的库存管理)详解编程语言
- SAP在Linux上安装(sap安装linux)
- SAP vs Oracle:差异点与解析(sap和oracle的区别)
- Oracle从SAP抽取数据的简单方法(oracle从sap抽数)
- 对比Oracle和SAP价格比较哪个是更值得投入的选择(oracle与sap价格)
- Oracle与SAP金蝶谁更具竞争力(oracle sap金蝶)
- Oracle SAP系统深入探索管理系统之魅力(oracle sap系统)
- 使用Oracle与SAP进行数据接口开发(oracle sap接口)
- jQuery温习篇强大的JQuery选择器
- jQuery学习笔记(2)--用jquery实现各种模态提示框代码及项目构架