网络服务不能,成功获取数据 [英] web service cannot, success to get data

查看:55
本文介绍了网络服务不能,成功获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从网站上获取网络服务

我发送参数我不知道什么不起作用



通过浏览器它工作正常我只是发送一个参数,

但在ajax它不起作用

这是网址

http://www.xmlsoccer.com/FootballDataDemo.asmx [ ^ ]



所有服务内容



这是我的代码:



function myEvents(){

$('#btnLeague')。on(click,function(){



var myApi =UGBYDUJKNNYOJKTOGWRSFUMBWUPDZKZFCQDZNMLXFMSAQDYLBW;

$ .ajax({

类型:'发布',

url:http://www.xmlsoccer.com/FootballDataDemo.asmx?op = GetAllLeagues,

数据:{ApiKey:'+ myApi +'},

contentType:application / json; charset = utf-8,

dataType:json,

成功:函数(数据){

alert(ok) ;

},错误:function(){alert(error);}



});





});



------------- ----------------------------------

这会出错func

i try to get a web sevice from web site
I send a parameter and I do not know what does not work

Through the browser it works fine I just send a parameter ,
but in ajax It does not work
this is the url
http://www.xmlsoccer.com/FootballDataDemo.asmx[^]

inside all the serives

this is my code:

function myEvents() {
$('#btnLeague').on("click", function () {

var myApi = "UGBYDUJKNNYOJKTOGWRSFUMBWUPDZKZFCQDZNMLXFMSAQDYLBW";
$.ajax({
type: 'Post',
url: "http://www.xmlsoccer.com/FootballDataDemo.asmx?op=GetAllLeagues",
data: "{ApiKey:'" + myApi + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
alert("ok");
}, error: function () { alert("error"); }

});


});

-----------------------------------------------
this is going to error func

推荐答案

('#btnLeague')。on(click,function(){



var myApi =UGBYDUJKNNYOJKTOGWRSFUMBWUPDZKZFCQDZNMLXFMSAQDYLBW;
('#btnLeague').on("click", function () {

var myApi = "UGBYDUJKNNYOJKTOGWRSFUMBWUPDZKZFCQDZNMLXFMSAQDYLBW";


.ajax({

类型:'发布',

url:http://www.xmlsoccer.com/FootballDataDemo.asmx?op=GetAllLeagues,

数据:{ApiKey:'+ myApi +'},

contentType:application / json; charset = utf-8,

dataType:json,

成功:函数(数据){

alert(ok);

},错误:function(){alert(error ); }



});





});



------------------------------------- ----------

这将是错误功能






您正在使用REST服务



Hi,

You are using a REST Service

function myEvents() {


这篇关于网络服务不能,成功获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆