Ola Galera. Tenho um site com web service chamado via jquery/ajax, porém no servidor local ele roda perfeitamente mais no servidor web ele não roda, cai direto na clausula error do ajax. Alguma ideia alguem do seja ?
grato
função Dentro da pasta scripts
$("#loginbtn").click(function () {
senha = document.getElementById("password").value;
nome = $("#Email").val();
var root = location.protocol + '//' + location.host + '/' + 'utilservice.asmx' + '/' + 'HelloWorld';
if (nome == "") {
document.getElementById("Email").setCustomValidity('Email Necessário ? Ex: jaoa@xxx.com.br');
return;
} else {
document.getElementById("Email").setCustomValidity('');
}
if (senha == "") {
document.getElementById("password").setCustomValidity('Senha Necessária ?');
return;
} else {
document.getElementById("password").setCustomValidity('');
}
if (nome != "" && senha != "") {
// alert(root);
document.getElementById("MsgUser").innerHTML = "Aguarde Dados do Usuário Sendo Validado !!!";
$.ajax({
type: "POST",
url: root,
dat: '{}',
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
cache: false,
success: function (response) {
$("#logindiv").hide();
alertify.alert('Alert', response.d, function (e) {
if (e) {
document.getElementById("form1").submit();
}
});
},
error: function (response) {
$("#logindiv").hide();
if (response.d == "" || response.d == null) {
alertify.alert('Error', XMLHttpRequest + status, function (e) {
if (e) {
document.getElementById("form1").submit();
return false;
}
});
} else {
alertify.alert('Error', response.d, function (e) {
if (e) {
document.getElementById("form1").submit();
return false;
}
});
}
}
});
}
});
web service na raiz do projeto
[WebService(Namespace = "http://interconectdigital.com.br/utilservice.asmx")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class utilservice : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}