hi everyone
4 a few days now im trying 2 get an asmx webservice to work via jquery
Heres my code
<script type="text/javascript">
$(document).ready(function () {
$("#btnTest").click(function () {
$.ajax({
type: "POST",
url: "/WebService.asmx/HelloWorld",
cache: false,
contentType: "application/json; charset=utf-8",
data: "{}",
dataType: "json",
success: function (data) {
alert(data);
},
error: function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus + ' ' + errorThrown + ' ' + XMLHttpRequest); }
});
});
});
</script>
The problem seems to be that the browser checks for this url:
http://localhost:52657/WebService.asmx/CheckSmtp
when it should really check for this url
http://localhost:52657/myappname/WebService.asmx/CheckSmtp
so I tried without the slash in the $.ajax url, but then its worse, because if im on a page admin/products/edit then the ajax goes to admin/products/edit/webservice.asmx which is definetly wrong
so how do I tell jquery to look in the root folder?
It may be that the problem is only on localhost, but I cant test anything this way
Thanks a million