从jQuery调用Web服务 [英] calling webservice from jquery
本文介绍了从jQuery调用Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的主机上有URL为 http://192.168.1.127:9009/service1.asmx []的Web服务. ^ ].该Web服务具有方法getChannel()
,该方法返回字符串.如何从我的项目中称呼它?我尝试如下,但它不起作用.
I have web service on my host having URL http://192.168.1.127:9009/service1.asmx[^]. This webservice has a method getChannel()
which returns a string. How can I call this from my project? I tried as follows but it''s not working.
<script type="text/javascript">
$(document).ready(function () {
$("#sayHelloButton").click(function (event) {
$.ajax({
type: "GET",
url: "http://192.168.1.127:9009/service1.asmx/get_voda_channels",
data: "{'name': '" + $('#name').val() + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
AjaxSucceeded(msg);
},
error: AjaxFailed
});
});
});
function AjaxSucceeded(result) {
alert(result.d);
}
function AjaxFailed(result) {
alert(result.status + ' ' + result.statusText);
}
</script>
请在这里帮助我.
Please help me out here.
推荐答案
(document).ready(function(){
(document).ready(function () {
(" #sayHelloButton").click(function(
("#sayHelloButton").click(function (event) {
.ajax({ 类型:" , url:" , 数据:" +
.ajax({ type: "GET", url: "http://192.168.1.127:9009/service1.asmx/get_voda_channels", data: "{'name': '" +
这篇关于从jQuery调用Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文