problem with jquery ajax while loading data in django page -
why following jquery code doesn't work when used django while works if loaded static page?
there's django's csrf protection involved somewhere, can't find how make work.
edited, stripped down code:
$(document).ready(function(){ $('.content').load('something.txt'); $.ajax({ method: "get",url: "http://something.com/pm/js/something.txt", success: function(html) { $(".content").html(html); } }); });
the purpose of should be: when django page loads, script should call django view(s) , load data them. (at moment make easier 'something.txt' static file)
...firebug doesn't show abnormal
i'm going take wild guess: maybe when load page django don't have static file serving setup properly, jquery never gets loaded, , such none of javascript gets executed.
to check , see if jquery getting loaded open firebug on page , see if jquery
variable undefined
.
if that's problem load jquery cdn now.
<script src="http://code.jquery.com/jquery-1.5.1.js"></script>
Comments
Post a Comment