嗨,我已经调用了一个 json 文件并显示了一些错误,你可以帮我吗
显示错误 Uncaught ReferenceError: marketlivedata is not defined
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!DOCTYPE html>
<html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:g="http://base.google.com/ns/1.0">
<head>
<title>Data Call to json</title>
<script type="text/javascript">
// =====================
$(document).ready(function(e) {
// alert('hello');
// var marketlivedata ;
});
// =====================
function getUserData() {
$.ajax({
type: "GET",
url: "http://xxxxxxxxx.xxxxxxx.com/xxxxxxx.json",
dataType: 'jsonp',
crossDomain: true,
success: function(data) {
// $('#ajexLoaderSec').hide();
console.log(data);
},
error: function(e) {
alert("There is an error while connecting to the server. Please try after some time");
}
});
};
getUserData();
</script>
</head>
<body>
gsdf sdf sdfsd sdf sd
</body>
</html>
我的json格式是
marketlivedata([{"sensex":{"trend":"equal","CloseIndexValue":"24893.81","premarket":"false","DateTime":"11:41 AM | 08 Sep 2015","CurrentIndexValue":"24958.31","Segment":"BSE","OpenIndexValue":"24972.01","PercentChange":"0.26","IndexName":"SENSEX","NetChange":"64.50"},"nifty":{"trend":"equal","CloseIndexValue":"7558.80","premarket":"false","DateTime":"11:41 AM | 08 Sep 2015","CurrentIndexValue":"7582.85","Segment":"NSE","OpenIndexValue":"7587.70","PercentChange":"0.32","IndexName":"CNX NIFTY","NetChange":"24.05"},"gold":{"ClosePrice":"26500.00","trend":"negative","OpenPrice":"26499.00","ExpiryDate":"2015-10-05","SpotSymbol":"SGOLDAHM","LastTradedPrice":"26441.00","DateTime":"8-September-2015 11:34:22","Symbol":"GOLD","PercentChange":"-0.22","CommodityName":"Gold","NetChange":"-59.00","PriceQuotationUnit":"10 GRMS ","SpotPrice":"26401.0"},"silver":{"ClosePrice":"35193.00","trend":"equal","OpenPrice":"35176.00","ExpiryDate":"2015-12-04","SpotSymbol":"SSILVERAHM","LastTradedPrice":"35070.00","DateTime":"8-September-2015 11:34:0","Symbol":"SILVER","PercentChange":"-0.35","CommodityName":"Silver","NetChange":"-123.00","PriceQuotationUnit":"1 KGS ","SpotPrice":"34815.0"},"USD/INR":{"DateTime":"2015-09-08 11:36:02.0","percentChange":"-0.27","netChange":"-0.18","name":"USD/INR","bidprice":"66.65"},"DXY Index":{"DateTime":"2015-09-08 11:39:40.0","percentChange":"-0.1","netChange":"-0.1","name":"DXY Index","bidprice":"96.13"},"marketstatus":{"currentMarketStatus":"Live"}}])
返回的数据为marketlivedata(...)
。这是在调用marketlivedata
未在脚本中定义的函数。由于将dataType用作jsonp
,因此将执行该函数。
为了解决这个问题,您可以更改JSON服务器中的数据格式(这看起来像第三方服务,因此可能无法实现),也可以定义该名称的函数,当响应到达时将调用该函数。
function getUserData() {
$.ajax({
type: "GET",
url: "http://mobilelivefeeds.indiatimes.com/homepagedatanew.json",
dataType: 'jsonp',
crossDomain: true,
success: function(data) {
// $('#ajexLoaderSec').hide();
console.log(data);
},
error: function(e) {
console.log(e);
}
});
};
getUserData();
function marketlivedata(data) {
console.log(data);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
我正在尝试将我的颤动应用程序连接到我的手机,但它不起作用...我在终端中写了,它向我展示了一些错误: 我正在使用VS代码(如果很重要)。SDK管理器的路径是什么?为什么对我说“视觉工作室未安装”,如果它写在VS代码终端中? 谢谢大家!
致命错误:未捕获的错误:调用/home/prasanth/projects/ishen1/index中的未定义函数mysqli_result()引发了堆栈跟踪:#0{main}
我得到空白页,而不是错误消息在浏览器中。但我可以查看错误在var/log/system.log 我安装了最新的magento 1.8 CE。我正在使用Ubuntu,我的站点根目录位于/var/www/chmoded 777。我已将其别名链接到我的主文件夹并从中进行操作。 我还没有取消评论index.php. 我将错误/local.xml.sample重命名为local.xml. 我还添加了 到.
我正在开发一个屏幕锁定的Android应用程序。我已经使用广播接收器的屏幕。在我的应用程序中,我想使用拖放。所以,当我使用时,它显示一个错误 JAVAlang.RuntimeException:在com中接收广播意图{act=init view flg=0x10}时出错。应用程序。锁屏图书馆。LockBroadcastReceiver@f22ed7d. 并且库文件引用是https://github
我有一个对象列表,它具有以下属性 公共类ViewTestCasesBean { } 现在我的行动代码是... 这里详细说明List是要在显示标签中显示的上述对象的List。 我尝试了以下方法 但是得到了以下错误... 编码有什么问题?