如何使用jquey调用远程iis上托管的wcf服务 [英] How to call wcf service hosted on remote iis using jquey

查看:93
本文介绍了如何使用jquey调用远程iis上托管的wcf服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是通过引用传递最后一个参数的真实方法

此代码始终返回失败

is this true way to pass last argument by references
this code always return fail

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script type = "text/javascript">
$(document).ready(function(){

        $("#login").click(function () {
var ret_data = "g";
alert("here");
 var html = "";
            $.ajax({
                type: "post",
                contentType: "application/json; charset=utf-8",
                url: 'http://10.19.193.74/unmswebservice/fcc.asmx/AuthenticateUser',
                data: {Username: '+ $("#prefix").val() +',Password: '+$("#pass").val()+',AuthenticatedToken: '+ret_data+' },
                processData: true,
                dataType: "json",
                success: function (response) {
                    var customers = eval(response.d);
alert(ret_data);

                    $("#results").html(html == "" ? "No results" : html);
                },
                error: function (a, b, c) {
                     alert("FF");

                   // alert(a.responseText);
                }
            });
        });
});
    </script>
</head>
<body>
    <form id="form1" action="http://10.19.193.74/unmswebservice/fcc.asmx" method="post">
   <span>user name</span> <input type ="text" id = "prefix" /> <br/>

    <span>password</span>   <input type="text",id="pass"/> <br/>

    <input id = "login" type = "button" value = "Search" />

    <div id = "results"></div>

    </form>
</body>
</html>

推荐答案

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


#login)。click( function (){
var ret_data = g;
alert( here);
var html = ;
("#login").click(function () { var ret_data = "g"; alert("here"); var html = "";


.ajax({
type: post
contentType: application / json; charset = utf-8
url:' http://10.19.193.74/unmswebservice/fcc.asmx/AuthenticateUser'
data:{Username:' +
.ajax({ type: "post", contentType: "application/json; charset=utf-8", url: 'http://10.19.193.74/unmswebservice/fcc.asmx/AuthenticateUser', data: {Username: '+


这篇关于如何使用jquey调用远程iis上托管的wcf服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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