我正在尝试调用一个具有JavaScript的Json输出的Web服务。但我无法获得价值。我尝试了不同的方法,但都没有成功。请帮忙!!
这是我试过的代码
<script src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
function callajax(){
var html =$.ajax({
cache: false,
type: "GET",
async: false,`enter code here`
data: {},
url: "http://domain/abc.php?param=abcd',
contentType: "application/json; charset=utf-8",
dataType: "json",
crossDomain: true,
Success: SucceedFunc,`enter code here`
error: function (request, errorText, errorCode)
{
alert(errorText+"--"+errorCode);
}
});
}
function SucceedFunc(data, status)
{
alert("Enter into Success");
alert(data);
}
所需输出位于{“name”:Alex,“Success”:true}格式。 我需要为“名字”选择价值。
帮助将不胜感激。
答案 0 :(得分:0)
是因为您的Success:
是大写的吗?应该是success:
。
编辑:
另外,你有没有理由使用这样一个旧版本的jQuery?它们现在是1.9.x(大多数用途)。我只是查了一下,并在1.5中添加了crossDomain选项。