在另一页面中显示搜索结果

时间:2018-04-25 05:43:32

标签: php ionic-framework

这是我的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) => {

    });
  }

如何在另一页上显示搜索结果?

0 个答案:

没有答案