我正在调用登录网络服务。但是我无法检查我将从服务器获得什么。我喜欢这个 ?这是我的网址和参数
这是我的尝试http://jsfiddle.net/LsKbJ/2/
$(document).ready(function () {
//event handler for submit button
$("#btnSubmit").click(function () {
//collect userName and password entered by users
var userName = $("#username").val();
var password = $("#password").val();
//call the authenticate function
authenticate(userName, password);
});
});
//authenticate function to make ajax call
function authenticate(userName, password) {
$.ajax
({
type: "POST",
//the url where you want to sent the userName and password to
url: "http://ii.c-cc.de/pp/REST",
dataType: 'json',
async: false,
crossDomain: true,
//json object to sent to the authentication url
data: {Username: userName, Password: password},
success: function () {
//do any process for successful authentication here
}
})
}
我建议你创建REST api来使用WCF获取和发布数据
我想你错过了服务URL中的方法名称MyMethodName。还要确保控制台中没有跨源错误。您可以从服务 URL 的帮助页面获取方法列表。
用于进行 ajax 调用的身份验证函数
url: "http://isuite.c-entron.de/CentronService/REST/MyMethodName",
例 : url: http://isuite.c-entron.de/CentronService/REST/GetLoggedInUser
将 MyMethodName 替换为上述身份验证方法的 URL 中的专有方法名称。