Click here to Skip to main content
15,910,277 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

Hi,

You are using a REST Service

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

});


I think you have provide the URL wrong just paste this code I think it will work

If it dose not work den please post the server code
Enjoy.
 
Share this answer
 
v2
Comments
Member 10631195 6-Jun-14 4:33am    
I do not understand the give me a c# .net code i tray to do that code in ajax this is
the sever address :
http://xmlsoccer.wikia.com/wiki/.NET_.dll_library_class_file_tutorial#Code
use jsonp type
dataType: "jsonp",
 
Share this answer
 
Comments
Member 10631195 5-Jun-14 17:53pm    
i try its steel go to error func

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900