Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Use your method name in the <code>url</code> parameter of ajax as eg: <code>url: "Service.asmx/ConversionRate"</code></p> <p>And if you are calling a webservice which is in different domain Eg: Your .js file in which you are writing ajax function is in <code>www.abc.com</code> and you are calling a web service in <code>www.xyz.com</code> (i.e) cross domain call, then you need to use server-routed proxy as shown below or use jsonp as cross domain call is not allowed by browsers.</p> <pre><code>var url = 'http://www.webservicex.net/Service1.asmx/ConversionRate; var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from xml where url="' + url + '"') + '&amp;format=json&amp;callback=?'; $j.ajax({ type: "GET", async: false, url: yql, dataType: 'XML', //contentType:'application/json', success: function (data) { if(data.query.results){ var result = data.query.results.double.content.replace(/&lt;script[^&gt;]*&gt;[\s\S]*?&lt;\/script&gt;/gi, ''); $j.each(result, function (index, element) { alert("Successful here: " + element); //$j('#json').append("&lt;li'&gt;"+element+"&lt;/li&gt;"); }); } } }); </code></pre> <p>Use either <code>success</code> or <code>done</code> function, as both of them serve the same purpose.</p> <p>And if you are using service from the same domain then the above said server-routed proxy not needed. Then the code will be as follows.</p> <pre><code> $j.ajax({ type: "GET", async: false, url: "Service1.asmx/GetConversion", dataType: 'XML', //contentType:'application/json', success: function (data) { $j.each(data, function (index, element) { alert("Successful here: " + element); //$j('#json').append("&lt;li'&gt;"+element+"&lt;/li&gt;"); }); } }); </code></pre>
    singulars
    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.
    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