Edit: Important: It is extremely unlikely that anybody who has come across this will have the exact same problem as me - check my answer below for my very obscure solution. There were however some useful responses that may apply to other's situations. Good luck if you're having a similar problem.
I've got a really simple jQuery AJAX call :
$("#cart").load("/woops/store/cartsummary");
This returns (by means of an ASP.NET MVC Action) some very simple HTML:
<DIV>something</DIV>
On my page I have a destination DIV which is initially populated with some HTML:
<div class="padding15" id="cart">
<% RenderCart(ViewData.Model.CartItems); %>
</div>
The problem is when the call returns the original #cart div just disappears instead of being replaced. If I look at the DOM in Chrome it is just completely empty. The correct HTML is definitely being returned because I see it in Fiddler.
In addition this code works (but obviously isn't what I want because it is appending) :
$.get("/woops/store/cartsummary", {}, function(data) {
$("#cart").append(data);
});
I think I'm just doing something stupid - but I'm switching from Microsoft AJAX to jQuery and I think theres just some small fundamental thing I'm misunderstanding. Where's my DIV gone?
(BTW: 'woops' is a virtual directory to make sure my site has no root relative links during development)