2 Replies Latest reply: Oct 24, 2014 5:06 PM by James Pike RSS

    AJAX issue with service call

      First I tried a simple HTML page to test a web service call. It took some work but ultimately I got it working. I have to set jQuery.support.cors = true. It is making a call to another machine on our same domain and the html page works great:

      Capture.JPG.jpg

      However now when I try to do the same thing in an extension object it errors. In fiddler I can see the call succeed with a 200 and the response I would expect. However that happened with the web page when it broke too, until I set cors = true. I am doing everything the same in the extension object. What am I missing? Note: I get same result in desktop and access point.

       

      Capture2.JPG.jpg

      Attached are the html page and the extension object.

        • Re: AJAX issue with service call

          For some more info, when the extension object executes, as you can see I get a 200 in Fiddler, but Firebug shows a bad call, but zero response or clues as to why. This is a call to localhost.

           

          Untitled.png

          • Re: AJAX issue with service call

            In case anyone is still tuning in... This is how I finally got it working. I needed to add the following to my web.config in the <system.webServer> node:

             

            <httpProtocol>

                 <customHeaders>

                   <add name="Access-Control-Allow-Origin" value="*" />

                   <add name="Access-Control-Allow-Methods" value="POST, GET, OPTIONS, PUT, DELETE" />

                   <add name="Access-Control-Allow-Headers" value="content-type,soapaction,x-requested-with" />     

                  </customHeaders>

                </httpProtocol>