title: Ajax request not receiving xml from Django
body: <p>I have a Django server which handles requests to a URL which will return some HTML for use in an image gallery. I can navigate to the URL and the browser will display the HTML that is returned, but I can't get that same HTML by doing an AJAX call (using jQuery) to the same URL.</p>
  
  <p>This is the view that generates the response:</p>
  
  <pre><code>def gallery_images(request, gallery_name):
      return render_to_response('galleryimages.html', {'images': get_images_of_gallery(gallery_name)}, mimetype='text/xml')
  </code></pre>
  
  <p>This is the 'galleryimages.html' template:</p>
  
  <pre><code>{% for image in images %}
  &lt;div id="{{image.name}}big"&gt;
      &lt;div class="actualImage" style="background-image:url({{image.image.name}});"&gt;
          &lt;h1&gt;{{image.caption|safe}}&lt;/h1&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  {% endfor %}
  </code></pre>
  
  <p>This is the jQuery call I am making:</p>
  
  <p><code>$("#allImages").load("http://localhost:8000/galleryimages/Web");</code></p>
  
  <p>However, this loads nothing into my #allImages div. I've used firebug and ran jQuery's Ajax method .get("<a href="http://localhost:8000/galleryimages/Web" rel="nofollow noreferrer">http://localhost:8000/galleryimages/Web</a>") and firebug says that the response text is completely empty.</p>
  
  <p>When I check my Django server log, this is the entry I see for when I navigate to the URL manually, through my browser:</p>
  
  <blockquote>
    <p>[16/Jan/2010 17:34:10] "GET
    /galleryimages/Web HTTP/1.1" 200 215</p>
  </blockquote>
  
  <p>This is the entry in the server log for when I make the AJAX call:</p>
  
  <blockquote>
    <p>[16/Jan/2010 17:36:19] "OPTIONS
    /galleryimages/Web HTTP/1.1" 200 215</p>
  </blockquote>
  
  <p>Why does the AJAX request not get the xml that my Django page is serving?</p>