Getting No 'Access-Control-Allow-Origin' when sending large JSON via AJAX Getting No 'Access-Control-Allow-Origin' when sending large JSON via AJAX json json

Getting No 'Access-Control-Allow-Origin' when sending large JSON via AJAX


By default browsers block json requests from other domains other than the page unless the json request has the Access-Control-Allow-Origin header, so you'll need to add that header to your json requests on that service or use the same domain for both.

More info here: https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS


You can try setting the maxJsonLength to it's maximum value in the web.config file.

<system.web.extensions>    <scripting>        <webServices>            <jsonSerialization maxJsonLength="2147483647"/>        </webServices>    </scripting></system.web.extensions>


I know this is an old post, but for anyone who still might be having this problem, I solved it by adding two settings to Web.config as described here: https://west-wind.com/webconnection/docs/_4lp0zgm9d.htm

<system.webServer>    <security>      <requestFiltering>        <requestLimits maxAllowedContentLength="2147483647"></requestLimits>      </requestFiltering>    </security>    <!--snip--></system.webServer>

and

<system.web>    <httpRuntime maxRequestLength="2147483647" />    <!--snip--></system.web>