I have the following web service;
[WebMethod]
public string HelloWorld()
{
return \"Hello World\";
}
It\'s stock st
I solved it simply by removing the domain from the request url.
Before: https://some.domain.com/_vti_bin/service.svc
After: /_vti_bin/service.svc
For me it is an entirely different story.
Since this page has a good search engine ranking, I should add my case and the solution here too.
I built jquery
myself with webpack
picking only the modules I use. The ajax is always failed with "No Transport" message as the only clue.
After a long debugging, the problem turns out to be XMLHttpRequest
is pluggable in jquery
and it not include by default.
You have to explicitly include jquery/src/ajax/xhr
file in order to make the ajax working in browsers.
I too got this problem and all solutions given above either failed or were not applicable due to client webservice restrictions.
For this, I added an iframe in my page which resided in the client;s server. So when we post our data to the iframe and the iframe then posts it to the webservice. Hence the cross-domain referencing is eliminated.
We added a 2-way origin check to confirm only authorized page posts data to and from the iframe.
Hope it helps
<iframe style="display:none;" id='receiver' name="receiver" src="https://iframe-address-at-client-server">
</iframe>
//send data to iframe
var hiddenFrame = document.getElementById('receiver').contentWindow;
hiddenFrame.postMessage(JSON.stringify(message), 'https://client-server-url');
//The iframe receives the data using the code:
window.onload = function () {
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
var eventer = window[eventMethod];
var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
eventer(messageEvent, function (e) {
var origin = e.origin;
//if origin not in pre-defined list, break and return
var messageFromParent = JSON.parse(e.data);
var json = messageFromParent.data;
//send json to web service using AJAX
//return the response back to source
e.source.postMessage(JSON.stringify(aJAXResponse), e.origin);
}, false);
}
None of the proposed answers completely worked for me. My use case is slightly different (doing an ajax get to an S3 .json file in IE9). Setting jQuery.support.cors = true;
got rid of the No Transport
error but I was still getting Permission denied
errors.
What did work for me was to use the jQuery-ajaxTransport-XDomainRequest to force IE9 to use XDomainRequest. Using this did not require setting jQuery.support.cors = true;
If your jQuery page isn't being loaded from http://localhost:54473
then this issue is probably because you're trying to make cross-domain request.
Update 1 Take a look at this blog post.
Update 2 If this is indeed the problem (and I suspect it is), you might want to check out JSONP as a solution. Here are a few links that might help you get started:
i solve it by using dataType='jsonp' at the place of dataType='json'