我打電話登錄Web服務。但我無法檢查我將從服務器獲得什麼。我喜歡這樣嗎? 這裏是我的網址和參數如何使用jquery調用wcf webservice json?
這裏是我的嘗試 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
}
})
}
您的端點爲POST請求返回404。 – haim770
嘗試使用,錯誤:函數(數據){警報(數據)} –
是的......這意味着找不到服務器,但服務器正在運行.. – user2648752