语法错误:意外的令牌〈(...)- dojo/ AJAX

8ehkhllq  于 2022-12-16  发布在  Dojo
关注(0)|答案(2)|浏览(139)

我在我的项目中使用了以下 AJAX

var _getWeatherInfo = function(ntown){
    //Debugging
    console.log("Before dojo.xhrget");
      //dojo ajax request used to call the PHP file and retrieve the towns data
      dojo.xhrGet({
          handleAs: "json",
          timeout: 5000,
          //php file URL (location)
          url: "PHP/weather.php?ntown=" + ntown,

          load: function(results) {
              //send the results to the function _refreshWeatherList
              _refreshWeatherList(results);               
        }

    });
    //Debugging
    console.log("After dojo.xhrget");
}

为了检索城市/城镇的天气数据。然而,它已经有一段时间了,因为我在这个项目上工作,我很难理解为什么这是不再工作(它是工作的最后一次我运行这个项目)。
在浏览器控制台中,我得到以下错误:

SyntaxError: Unexpected token <
    at Object.b.fromJson (http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js:227:426)
    at Object.b._contentHandlers.b.contentHandlers.json (http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js:185:216)
    at t (http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js:189:392)
    at c (http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js:75:221)
    at d (http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js:75:10)
    at resolve.callback (http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js:76:350)
    at http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js:192:378
    at k (http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js:196:406)
    at n (http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js:196:332)
    at resolve (http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js:198:406)y @ dojo.js.uncompressed.js:14021(anonymous function) @ dojo.js.uncompressed.js:13981c @ dojo.js.uncompressed.js:4579d @ dojo.js.uncompressed.js:4560reject.errback @ dojo.js.uncompressed.js:4655c @ dojo.js.uncompressed.js:4594d @ dojo.js.uncompressed.js:4560reject.errback @ dojo.js.uncompressed.js:4655c @ dojo.js.uncompressed.js:4590d @ dojo.js.uncompressed.js:4560resolve.callback @ dojo.js.uncompressed.js:4640(anonymous function) @ dojo.js.uncompressed.js:14208k @ dojo.js.uncompressed.js:14488n @ dojo.js.uncompressed.js:14479resolve @ dojo.js.uncompressed.js:14643a @ dojo.js.uncompressed.js:14532k @ dojo.js.uncompressed.js:14503n @ dojo.js.uncompressed.js:14479resolve @ dojo.js.uncompressed.js:14643a @ dojo.js.uncompressed.js:14532k @ dojo.js.uncompressed.js:14509n @ dojo.js.uncompressed.js:14479resolve @ dojo.js.uncompressed.js:14643a @ dojo.js.uncompressed.js:14532k @ dojo.js.uncompressed.js:14503n @ dojo.js.uncompressed.js:14479resolve @ dojo.js.uncompressed.js:14643r @ dojo.js.uncompressed.js:11883f @ dojo.js.uncompressed.js:11909

我包括dojo使用:

<script src="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js"></script>

xhr响应:

"<!--Include Database connections info-->


↵↵(!) Deprecated: mysql_连接():mysql扩展已弃用,将来将被删除:使用mysqli或PDO代替E:\程序文件(x86)\wamp\www\Weather-Widget-App-master\PHP\configHome.php在第6行调用堆栈#时间存储器函数位置10.0004244528{main}()..\weather.php**:0 20.0006248360include('E:\程序文件(x86)\wamp\www\Weather-Widget-App-master\PHP\configHome.php')..\weather.php2 30.0006248936http://www.php.net/function.mysql-connect ' target ='_new '〉mysql_connect()..\configHome.php6.
↵↵(!) Warning: mysql_select_db()期望参数1是字符串,资源在E:\Program Files(x86)\wamp\www\Weather-Widget-App-master\PHP\configHome.php中给出,位于9调用堆栈#TimeMemoryFunctionLocation 10.0004244528{main}()..\weather.php
0 20.0006248360include('E:\Program Files(x86)\wamp\www\Weather-Widget-App-master\PHP\configHome.php')..\weather.php2 30.0300257280http://www.php.net/function.mysql-select-db ' target ='_new '〉mysql_select_db()..\configHome.php:**9在mysql“

slwdgvem

slwdgvem1#

我的问题是无效/贬值的MySQL。我用MySQLi重写了我的MySQL,一切都到位了。

xe55xuns

xe55xuns2#

我在从一个服务返回JSON时遇到了这个问题,我以前在这个服务中var_dump了一些东西。呃。希望它能帮助一些人,因为我浪费了10分钟来寻找原因。

相关问题