php - 在另一个页面中显示搜索结果
问题描述
这是我通过 pin 码搜索数据的 api 代码:
function findPlace(){
$request = \Slim\Slim::getInstance()->request();
$pinCode = json_decode($request->getBody());
try {
if(1){
$vendorSearchData = '';
$db = getDB();
$sql = "SELECT vendor_name,logo,phone_no FROM vender_list WHERE post_code LIKE :post_code";
$stmt = $db->prepare($sql);
$stmt->bindParam("post_code", $pinCode, PDO::PARAM_STR);
$stmt->execute();
//echo "<pre>"; print_r($stmt); echo"</pre>";die;
$vendorSearchData = $stmt->fetchAll(PDO::FETCH_OBJ);
$db = null;
if($vendorSearchData)
echo '{"vendorSearchData": ' . json_encode($vendorSearchData) . '}';
else
echo '{"vendorSearchData": ""}';
} else{
echo '{"error":{"text":"No access"}}';
}
} catch(PDOException $e) {
echo '{"error":{"text":'. $e->getMessage() .'}}';
}
}
这是文件,我在其中调用函数来查找数据。如果它true
,那么将导航到另一个页面,但在该页面上我得到空白页:
findPlace(searchVal){
this.authService.postData(this.vendorSearchPostData, "findPlace")
.then((result) => {
this.responseData = result;
if (this.responseData.vendorSearchData) {
this.dataSet = this.responseData.vendorSearchData;
this.navCtrl.push(SearchResultPage, { data: searchVal});
} else {
let toast = this.toastCtrl.create({
message: "No data Found",
duration: 2000
});
toast.present();
}
}, (err) => {
});
}
如何在另一个页面上显示搜索结果?
解决方案
推荐阅读
- typescript - npm包导出构造函数的定义文件最佳实践
- python - 将 tfRecord 文件用于具有可变滞后的时间序列
- apache-flink - Flink减少计算期间如何获取当前窗口之前的最后一个值
- jhipster - JHipster JDL:如何在微服务之间链接实体(按 ID)?
- java - 如何更新firebase用户android的个人资料图片?
- javascript - JavaScript (WebStorm) 全局变量无法识别
- css - 转换时背景颜色不填充表格单元格
- batch-file - 批处理 - 使用注册表更改壁纸仅在用户完成时才有效
- imagemagick - mogrify -strip 是 imagemagick6 中 TIFF 的无损操作吗?
- android - 底部导航更改所选图标颜色