2012-04-23 12 views
2

Jquery AJAXを使用してWebサービスhttp://www.w3schools.com/webservices/tempconvert.asmxを呼び出そうとしています。JqueryがWebサービスを呼び出すことができません

function AppendListItems() { 
      var webMethod = "http://www.w3schools.com/webservices/tempconvert.asmx/CelsiusToFahrenheit"; 
      jQuery.support.cors = true; 
      $.ajax({ 
       type: "POST", 
       contentType: "application/json; charset=utf-8", 
       dataType: "json", 
       url: webMethod, 
       data: { Celsius: "10" }, 
       success: function (msg) { 

        $("#lstPhoneNames").append("<li>" + msg.d + "</li>"); 
       }, 
       error: function (ex, a, b) { 
        alert(b); 
       } 
      }); 

     }; 

しかし、コールはそれはエラーログを返す失敗します

<span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1> 

      <h2> <i>Runtime Error</i> </h2></span> 

      <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> 

      <b> Description: </b>An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. 
      <br><br> 

      <b>Details:</b> To enable the details of this specific error message to be viewable on remote machines, please create a &lt;customErrors&gt; tag within a &quot;web.config&quot; configuration file located in the root directory of the current web application. This &lt;customErrors&gt; tag should then have its &quot;mode&quot; attribute set to &quot;Off&quot;.<br><br> 

      <table width=100% bgcolor="#ffffcc"> 
       <tr> 
        <td> 
         <code><pre> 

&lt;!-- Web.Config Configuration File --&gt; 

&lt;configuration&gt; 
    &lt;system.web&gt; 
     &lt;customErrors mode=&quot;Off&quot;/&gt; 
    &lt;/system.web&gt; 
&lt;/configuration&gt;</pre></code> 

        </td> 
       </tr> 
      </table> 

      <br> 

      <b>Notes:</b> The current error page you are seeing can be replaced by a custom error page by modifying the &quot;defaultRedirect&quot; attribute of the application&#39;s &lt;customErrors&gt; configuration tag to point to a custom error page URL.<br><br> 

      <table width=100% bgcolor="#ffffcc"> 
       <tr> 
        <td> 
         <code><pre> 

&lt;!-- Web.Config Configuration File --&gt; 

&lt;configuration&gt; 
    &lt;system.web&gt; 
     &lt;customErrors mode=&quot;RemoteOnly&quot; defaultRedirect=&quot;mycustompage.htm&quot;/&gt; 
    &lt;/system.web&gt; 
&lt;/configuration&gt;</pre></code> 

        </td> 
       </tr> 
      </table> 

      <br> 

    </body> 

は私がサービス間違った方法を呼び出すのですか?準備ができて文書に追加

+0

これはブラウザ、エミュレータまたは実際のデバイスでテストしていますか? – Th0rndike

+0

yup私はこれをIEでテストしています。クロムブラウザ – Tuscan

+0

jquery-mobileを使っているときに、ブラウザからajax呼び出しをテストすることはできませんでした。どういうわけか、エミュレータまたは実際のデバイスでのみ動作します。私は誰かが間違っていることを知っているかどうかを知りたいです。 – Th0rndike

答えて

0

挑戦:実際の要求はFiddlerのようないくつかのツールを使用してサーバに送信されるもの

jQuery.support.cors = true; 
+0

ありがとうございますが、動作しませんでした – Tuscan

0

チェック。実際に何が必要なのか、送信する内容に違いがあるかもしれません。

関連する問題