Such large parameters should be sent and not sent in the URL.
$.ajax({ type: 'POST', url: '/Run', data: { param1: param1, param2: param2 }, dataType: 'html', error: function(error) { }, success: function(html) { } });
This will automatically handle the encoding of the parameters. If you absolutely insist on sending them to the url, you can declare a global javascript variable that will contain the url to call:
<script type="text/javascript"> var url = '<%= Url.Action("Run"), new { param1 = "value1", param2 = "value2" } %>'; $(function() { $.ajax({ type: 'POST', url: url, dataType: 'html', error: function(error) { }, success: function(html) { } }); }); </script>
source share