Route configuration looking for an id in my URL
<p>How do I correct my routing to fix an issue with ajax .load()</p>

<p>I modified my route to my spacecontroller so that it looks like this</p>

<pre><code>routes.MapRoute(
            name: "SpaceCleanRoute",
            url: "Space/{id}",
            defaults: new { controller = "Space", action = "Index" }
        );
</code></pre>

<p>so that I have a cleaner route and when a user wants to see a space the URL will look like this</p>

<blockquote>
  <p>www.mysite/space/12345</p>
</blockquote>

<p>the problem I'm having now is when my JS file calls a .load() like this, , where spaceoverview is my action</p>

<pre><code>$("#partialPageContainer").load('/Space/SpaceOverview', function (response, status, xhr) {
        alert("Load was performed.");
    });
</code></pre>

<p>I get an error saying</p>

<blockquote>
  <p>The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Index(Int32)' in 'YogaBandy2017.Controllers.SpaceController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
  Parameter name: parameters</p>
</blockquote>

<p>So I have to put an id after the url like this, which is not what I want, or doesn't seem right to me</p>

<p>How can I fix this or is this just how the routing works? I'm kinda new to mvc routing with ASP.Net</p>

<pre><code>$("#partialPageContainer").load('/Space/SpaceOverview/1', function (response, status, xhr) {
        alert("Load was performed.");
    });
</code></pre>

<p>UPDATED - I guess for now I'll just use '/space/actionname/1' to connect to each action, until I can find a better solution.</p>