2013-07-28 141 views
0

我想調用一個具有JavaScript的Json輸出的web服務。但我無法獲得價值。我嘗試了不同的方法,但沒有成功。請幫忙 !!從web服務調用javascript

這裏是我試過

<script src="jquery-1.3.2.min.js"></script> 
    <script type="text/javascript"> 

    function callajax(){ 
    var html =$.ajax({ 
     cache: false, 
     type: "GET", 
     async: false,`enter code here` 
     data: {}, 
     url: "http://domain/abc.php?param=abcd', 
     contentType: "application/json; charset=utf-8", 
     dataType: "json", 
     crossDomain: true, 
     Success: SucceedFunc,`enter code here` 
     error: function (request, errorText, errorCode) 
     { 
     alert(errorText+"--"+errorCode); 
     } 
    });  
    } 
    function SucceedFunc(data, status) 
    { 
    alert("Enter into Success"); 
    alert(data); 
    } 
代碼

所需的輸出是{ 「名」:亞歷克斯, 「成功」:真正}格式。 我需要爲「名稱」選擇值。

幫助將不勝感激。

回答

0

是因爲你的Success:是大寫?應該是success:

編輯:

此外,有沒有你使用這樣一箇舊版本的jQuery的原因是什麼?他們現在在1.9.x(對於大多數用途)。我只是查了一下,並在1.5中添加了crossDomain選項。

+0

感謝您的快速回復瑞安 我現在試着用 即使在那時我面臨同樣的問題。 我希望我遵循正確的方式。 – sattawar