gpt4 book ai didi

mysql - 我应该如何从英特尔 XDK Web 应用程序向 MySQL 发出请求?

转载 作者:行者123 更新时间:2023-11-29 23:55:19 24 4
gpt4 key购买 nike

我正在开发一个瘦 Web 应用程序,它接受一些搜索条件,搜索 mysql 数据库,然后在应用程序的另一个页面上返回该信息。我对英特尔 XDK 和一般的 Web 应用程序还不熟悉。我真正想要的是一些说明和伪代码,甚至是有帮助的地方的链接。我只是不确定哪些代码与 XDK 对应。任何帮助都会很棒。谢谢!

<!DOCTYPE html>
<html><!--HTML5 doctype-->

<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="Pragma" content="no-cache">
<script type="text/javascript" charset="utf-8" src="intelxdk.js"></script>
<script type="text/javascript" language="javascript">
var isIntel=window.intel&&window.intel.xdk
// This event handler is fired once the intel libraries are ready
function onDeviceReady() {
//hide splash screen now that our app is ready to run
intel.xdk.device.hideSplashScreen();
setTimeout(function () {
$.ui.launch();
}, 50);
}
//initial event handler to detect when intel is ready to roll
document.addEventListener("intel.xdk.device.ready", onDeviceReady, false);
</script>
<script src="js/appframework.ui.min.js"></script>
<script>
if(isIntel)
$.ui.autoLaunch = false;
$.ui.useOSThemes = true; //Change this to false to force a device theme
$.ui.blockPageScroll();
$(document).ready(function () {
if ($.ui.useOSThemes && (!$.os.ios||$.os.ios7))
$("#afui").removeClass("ios");
});
</script>
<link href="css/icons.css" rel="stylesheet" type="text/css">
<link href="css/af.ui.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="afui" class="ios">
<div id="header" class="header"></div>
<div id="content" style="">
<div class="panel" title="Main" data-nav="nav_0" id="main" selected="selected"
style="" data-appbuilder-object="page">

<div class="container" style="width: 100%; height: 100%; position: relative;" data-appbuilder-object="container">
<img src="images/PLD_banner_1100.jpg" style="width: 100%; height: auto;" alt="Title"
data-appbuilder-object="image" class="" title="PLDbanner">
<div class="select_element form_element" style="width: 100%; overflow: hidden; margin-bottom: 15px;"
data-appbuilder-object="select">
<label for="">Search Category:</label>
<select id="" multiple="multiple">
<option value="filenum" selected="">File Number</option>
<option value="listeeName">Listee Name</option>
<option value="standard">Standard</option>
<option value="productdesc">Product Description</option>
<option value="lmac">Listed Model/Additional Company</option>
</select>
</div>
<div class="select_element form_element" style="width: 100%; overflow: hidden;"
data-appbuilder-object="select">
<label for="">Search for...</label>
<select id="" multiple="multiple">
<option value="exact" selected="">Exact Text</option>
<option value="all">All Keywords</option>
<option value="any">Any Keywords</option>
</select>
</div>
<div class="text_item" data-appbuilder-object="text" style="margin-top: 15px; margin-bottom: 15px; text-align: center;">Enter File Number, Listee Name, Product Description, Standard or
Listed Model.</div>
<div class="input_element form_element" style="width: 100%; overflow: auto; margin-bottom: 15px;"
data-appbuilder-object="input">
<label for="txtSearch"></label>
<input type="text" style="float:left;" id="txtSearch" placeholder="">
</div><a class="button" href="#" style="position: relative; width: 100%; z-index: 2;"
data-appbuilder-object="button" data-transition="slide">Search</a>
</div>
</div>
<div class="panel" title="New Page" data-nav="nav_0" id="page_1" data-appbuilder-object="page"
style=""></div>
<div class="panel" title="New Page" data-nav="nav_0" id="page_2" data-appbuilder-object="page"
style=""></div>
<div class="panel" title="New Page" data-nav="nav_0" id="page_3" data-appbuilder-object="page"
style=""></div>
</div>
<div id="navbar" class="footer">
<a href="#main" class="icon home">Home</a>
</div>
<header id="header_0" data-appbuilder-object="header">
<a id="backButton" href="#" class="button backButton" style="visibility: visible; ">Back</a>
<h1 id="pageTitle" class="">test</h1>
</header>
<nav id="nav_0" data-appbuilder-object="nav">
<h1>Side Menu</h1>
</nav>
</div>
</body>




</html>

这是我的网络应用程序主页的代码。大部分都是内置的(我选择了 appStarter),然后我主要只是将表单拖放到界面上,而不是自己硬编码。所以我是这里的主要新手。

最佳答案

我在 JavaScript 文件上处理 AJAX 请求。我认为XDK在您的目录(www)的js文件夹下提供了一个名为index_user_scripts.js的默认文件,您可以在那里添加您的函数或创建您自己的.js文件。您必须将其包含在 index.html 头部的底部,如下所示:

       <head>
/*stylesheets and other stuff goes here*/
<script type="application/javascript" src="js/index_user_scripts.js"></script>
</head>

使用 AJAX 的函数示例:

        `$(function() 
{
$("#searchButton").click(function()
{
$.ajax
({
type: "POST",
url: "http://yourwebpage.php",
data: string,
success: function(xml)
{

},
error: function(jqXHR, textStatus, errorThrown)
{
alert(errorThrown.message);
}

});

});

});`

希望这对您有帮助!

关于mysql - 我应该如何从英特尔 XDK Web 应用程序向 MySQL 发出请求?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25408898/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com