English 中文(简体)
JQuery ajax () 方法
原标题:JQuery ajax() method
  • 时间:2012-05-24 16:42:03
  •  标签:
  • jquery

我的ajax 方法总是返回服务失败的服务, 尽管 WCF 服务方法返回成功( 我通过设置断点来验证 ) 。 代码显示在下面 。 可能有什么错?

function LoginToServer(name, password) {
    server = "localhost:1706";
    Type = "GET";
    var encodeusername = $.base64.encode(encode_utf8(name.value));
    var encodepwd = encode_utf8(password.value);
    var params =  username=  + encodeusername +  &password=  + encodepwd +  &clientip=none ;
    Url = "http://" + server + "/WCF/Test/TestService.svc/rest/Login?" + params;
    ContentType = "application/json; charset=utf-8";
    DataType = "jsonp";
    ProcessData = true;
    JsonpCallback = "alertResponse",
    method = "Login";
    CallService();
}


function CallService() {
    $.ajax({
        type: Type, //GET or POST or PUT or DELETE verb
        url: Url, // Location of the service
        data: Data, //Data sent to server
        contentType: ContentType, // content type sent to server
        dataType: DataType, //Expected data format from server
        processdata: ProcessData, //True or False
        jsonpCallback: JsonpCallback,
        success: function (msg) {//On Successfull service call
            ServiceSucceeded(msg);
        },
        error: ServiceFailed// When Service call fails
    });

周转基金服务方法的定义如下:

    [OperationContract]
    [WebGet(ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json,
            UriTemplate = "/Login?username={username}&password={password}&clientip={clientip}")]
    AuthenticationStatus SlideViewerLogin(string username, string password, string clientip);

谢谢

最佳回答
问题回答

我认为您需要将变量“ 参数” 传递到您有数据的地方: 数据, 它正在查找数据中的东西, 但我在您函数中看不到一个变量指定的数据 。





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签