Note that there are some explanatory texts on larger screens.

plurals
  1. POCall remote asmx service by JQuery always fail
    primarykey
    data
    text
    <p>I want to use below service throw JQuery: <a href="http://www.webservicex.net/globalweather.asmx/GetCitiesByCountry" rel="nofollow">http://www.webservicex.net/globalweather.asmx/GetCitiesByCountry</a> But it only execute the error function, I tried below :</p> <pre><code> function serviceCall() { var txtInput = $("#txtInput").val(); var webMethod = 'http://www.webservicex.net/globalweather.asmx/GetCitiesByCountry'; var datap = {"CountryName":JSON.stringify("Italy")}; $("#divResult").html('loading...'); $.ajax({ type: "POST", url: webMethod, data: datap,// { "CountryName" : JSON.stringify("Italy")}, contentType: "application/json; charset=utf-8", dataType: "jsonp", //for Firefox change this to "jsonp" success: function (response) { alert("reached success"); $("#divResult").html(response.d); }, error: function (e) { $("#divResult").html("Unavailable: " + txtInput); } }); } </code></pre> <p>SO I receive Unavailable: Italy</p> <p>Below is full page code : </p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function serviceCall() { var txtInput = $("#txtInput").val(); var webMethod = 'http://www.webservicex.net/globalweather.asmx/GetCitiesByCountry'; var datap = {"CountryName":JSON.stringify("Italy")}; $("#divResult").html('loading...'); $.ajax({ type: "POST", url: webMethod, data: datap,// { "CountryName" : JSON.stringify("Italy")}, contentType: "application/json; charset=utf-8", dataType: "jsonp", //for Firefox change this to "jsonp" success: function (response) { alert("reached success"); $("#divResult").html(response.d); }, error: function (e) { $("#divResult").html("Unavailable: " + txtInput); } }); } &lt;/script&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;input type="text" id="txtInput" value="Italy"/&gt; &lt;br /&gt; &lt;div style="width: 100px; height: 30px; background-color: yellow;" onclick="serviceCall();"&gt; Click me&lt;/div&gt; &lt;div id="divResult" runat="server"&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Any help to fix that?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload