title: my ajax throwing 404 error?
body: <p>I have written an AJAX call which works fine but after successfully running firebug, shows the error: <a href="http://localhost:8000/js/main.js" rel="nofollow">http://localhost:8000/js/main.js</a> Moved permanantly and 404. But Why is it searching for a js file when the call returns successful.</p>
  
  <p>My Ajax:</p>
  
  <pre><code>$.ajax({
  
          type:'POST',
  
          url:"/foobar/",
  
          data:{"foo": bar},
  
          success:function(data) {
  
              $('#wrapper').html(data);
  
          }
  
          });
  </code></pre>
  
  <p><strong>First Response:</strong></p>
  
  <pre><code>&lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
  &lt;title&gt;Mailserved&lt;/title&gt;
  &lt;link href="css/new-master.css" rel="stylesheet" type="text/css" /&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="scripts/jquery.editinplace.js"&gt;&lt;/script&gt;
  &lt;script src="scripts/main.js" type="text/javascript"&gt;&lt;/script&gt; 
  &lt;/head
  &lt;body&gt;
  // Here body .......
  &lt;/body&gt;
  </code></pre>
  
  <p><strong>Second Response</strong></p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta http-equiv="content-type" content="text/html; charset=utf-8"&gt;
    &lt;title&gt;Page not found at /foobar/js/main.js/&lt;/title&gt;
    &lt;meta name="robots" content="NONE,NOARCHIVE"&gt;
    &lt;style type="text/css"&gt;
      html * { padding:0; margin:0; }
      body * { padding:10px 20px; }
      body * * { padding:0; }
      body { font:small sans-serif; background:#eee; }
      body&gt;div { border-bottom:1px solid #ddd; }
      h1 { font-weight:normal; margin-bottom:.4em; }
      h1 span { font-size:60%; color:#666; font-weight:normal; }
      table { border:none; border-collapse: collapse; width:100%; }
      td, th { vertical-align:top; padding:2px 3px; }
      th { width:12em; text-align:right; color:#666; padding-right:.5em; }
      #info { background:#f6f6f6; }
      #info ol { margin: 0.5em 4em; }
      #info ol li { font-family: monospace; }
      #summary { background: #ffc; }
      #explanation { background:#eee; border-bottom: 0px none; }
    &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div id="summary"&gt;
      &lt;h1&gt;Page not found &lt;span&gt;(404)&lt;/span&gt;&lt;/h1&gt;
      &lt;table class="meta"&gt;
        &lt;tr&gt;
          &lt;th&gt;Request Method:&lt;/th&gt;
          &lt;td&gt;GET&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;Request URL:&lt;/th&gt;
        &lt;td&gt;http://localhost:8000/foobar/send/js/main.js/&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/div&gt;
    &lt;div id="info"&gt;
  
        &lt;p&gt;&lt;/p&gt;
  
    &lt;/div&gt;
  
    &lt;div id="explanation"&gt;
      &lt;p&gt;
        You're seeing this error because you have &lt;code&gt;DEBUG = True&lt;/code&gt; in
        your Django settings file. Change that to &lt;code&gt;False&lt;/code&gt;, and Django
        will display a standard 404 page.
      &lt;/p&gt;
    &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
      &lt;/html&gt;
  </code></pre>
  
  <p><strong>observation:</strong></p>
  
  <pre><code>&lt;th&gt;Request URL:&lt;/th&gt;
            &lt;td&gt;http://localhost:8000/foobar/send/js/main.js/&lt;/td&gt;
  </code></pre>
  
  <p>This might cause problem Why this is coming and how to resolve</p>