亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

jQuery ajax 不將數據從 php 顯示到帶有 angularjs 和 json 的表

jQuery ajax 不將數據從 php 顯示到帶有 angularjs 和 json 的表

PHP
米琪卡哇伊 2021-10-22 15:11:44
我正在嘗試使用 angular 和 json 將數據庫中的一些數據顯示到我的 html 頁面,但是即使設法讀取我的數據庫,瀏覽器也不會顯示我的數據。有人可以解釋為什么會這樣嗎?我在這個網站上看了幾個答案,但沒有一個能解決問題,甚至從不同的瀏覽器和從 unix 切換到 Windows。這是我的控制器myApp.controller('postCtrl',function($scope){    $.ajax({        type: 'GET',        url: './webservices/post.php',        dataType : 'json',        success : function(response){                $scope.locali = response.info;                  $scope.posts = response.info;                console.log($scope.locali);         },         fail: function(result){            $("#messaggiodierrore").html("query non riuscita! ");        }    });        console.log($scope.locali);});這是我的 html<div class="col-md-8" ng-controller = "postCtrl">    <table class="table table-hover">      <thead>        <tr>          <th>Locale </th>          <th>Indirizzo</th>          <th>città</th>          <th>attrezzature</th>        </tr>      </thead>      <tbody >        <tr ng-repeat="locale in locali track by $index" >          <td>{{locale.nomeLocale}}   </td>          <td>{{locale.indirizzo}}    </td>           <td>{{locale.citta}}        </td>          <td>{{locale.attrezzature}} </td>          <td><a class="btn btn-default" href="#!rispondi">Rispondi</a>          </td>        </tr>      </tbody>     </table></div>這是我的 php(正在運行)<?phpinclude_once('config.php');$sql= "SELECT * FROM locale";$query = mysqli_query($conn,$sql) or trigger_error("Query Failed! SQL: $sql - Error: ".mysqli_error(), E_USER_ERROR);if(mysqli_num_rows($query) > 0){    while($row = mysqli_fetch_assoc($query)){        $locale = $row['NomeLocale'];        $indirizzo = $row['indirizzo'];        $citta = $row['citta'];        $attrezzature = $row['attrezzature'];        $result[] = array('nomeLocale'=>$locale, 'indirizzo'=>$indirizzo,'citta'=>$citta,'attrezzature'=>$attrezzature);    } 谷歌瀏覽器控制臺發送給我這個:[{"nomeLocale":"asdf","indirizzo":"asdf","citta":"asdf","attrezzature":"0"}]這就是我的數據庫中的內容,但我無法理解為什么這沒有顯示在我的 html 表格中。`
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 161 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號