使用Javascript连接WCF Web服务 [英] Connect WCF webservice using Javascript

查看:77
本文介绍了使用Javascript连接WCF Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用下面代码从Javascript(Metro风格应用程序)连接到WCF服务器。请建议我,我做错了。

I am using belowcode to connect to WCF servcie from Javascript (Metro style apps). Please suggest me i fi did it wrong.

函数callWCF(){
$
        WinJS.xhr({

            type:" POST",

            url:" http://....../Sample.svc/GetAuthorizedReportScopes ",
         ;    headers:{" Content-type":" application / x-www-form-urlencoded"}

        })。然后(
$
        function(request){

             var data = window.JSON.parse(request.responseText);

             var item = {

               标题:"帐户页面",

               内容:"",&
                backgroundColor:'rgba(25,50,200,1)'

            }
        },$
       功能(请求){

            goError(request.status);

        }
        );;
    }

function callWCF() {
        WinJS.xhr({
            type: "POST",
            url: "http://....../Sample.svc/GetAuthorizedReportScopes",
            headers: { "Content-type": "application/x-www-form-urlencoded" }
        }).then(
        function (request) {
            var data = window.JSON.parse(request.responseText);
            var item = {
                title: "Account Page",
                content: "",
                backgroundColor: 'rgba(25,50,200,1)'
            }
        },
        function (request) {
            goError(request.status);
        }
        );
    }

 

推荐答案

嗨M,

在此论坛中搜索WCF。 你会看到很多帖子。

Search this forum for WCF.  You will see lots of posts.

这个帖子也应该有所帮助:
http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/fbe0de8a-3bc6-443a-8188 -f67465797cd9

This thread should help too: http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/fbe0de8a-3bc6-443a-8188-f67465797cd9

-Jeff


这篇关于使用Javascript连接WCF Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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