从javascript调用WCF服务:未收到任何响应 [英] Call WCF service from javascript: not getting any response

查看:62
本文介绍了从javascript调用WCF服务:未收到任何响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have written a wcf service and Iam calling that from javascript.But I couldnt view any response
My code is ..
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript"                   src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">

function invokeService() {
$(document).ready(function(){
$.ajax({
type:"GET",
async:false,
url:"http://localhost:8732/IServices/RoleService/json/name/doctor",
contentType:"application/json; charset=utf-8",
dataType:"json",
processData:true,
success:function(result){
AjaxSucceeded(result);
},
eror:AjaxFailed
});
function AjaxSucceeded(result)
{
alert(result);
}
function AjaxFailed(result){
alert(result.status+''+result.statusText);
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="button" onclick="javascript:invokeService();" value="Call WCF Service" />
</div>
</form>
</body>

How can I resolve it?Im getting neither errors nor response ?Where I am going wrong?
Thanks...

推荐答案

(document).ready(function(){
(document).ready(function(){


.ajax({ 类型:"GET", 异步:假, 网址:"http://localhost:8732/IServices/RoleService/json/name/doctor", contentType:"application/json; charset = utf-8", dataType:"json", processData:true, 成功:功能(结果){ AjaxSucceeded(结果); }, eror:Ajax失败 }); 函数AjaxSucceeded(结果) { 警报(结果); } 函数AjaxFailed(result){ alert(result.status +''+ result.statusText); } } < /script > < /head > < 正文 > < 表单 =" form1" runat >服务器" > < div > < 输入 =" 按钮" onclick javascript:invokeService ();" 致电WCF服务" / > < /div > < /form > < /body > 我该如何解决?没有错误也没有反应?我要去哪里? 谢谢...
.ajax({ type:"GET", async:false, url:"http://localhost:8732/IServices/RoleService/json/name/doctor", contentType:"application/json; charset=utf-8", dataType:"json", processData:true, success:function(result){ AjaxSucceeded(result); }, eror:AjaxFailed }); function AjaxSucceeded(result) { alert(result); } function AjaxFailed(result){ alert(result.status+''+result.statusText); } } </script> </head> <body> <form id="form1" runat="server"> <div> <input type="button" onclick="javascript:invokeService();" value="Call WCF Service" /> </div> </form> </body> How can I resolve it?Im getting neither errors nor response ?Where I am going wrong? Thanks...


看看

这篇关于从javascript调用WCF服务:未收到任何响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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