Trying to simply make an ajax call to my view and get the template html back.
$(document).ready(function () {
$.ajax({
url:url,
data:{language:'English'},
dataType:'html',
success:function (data, status, xhr) {
alert('works yea');
$('#profiles-section').html(data);
}
error: function(data){
alert('errors');
}
});
});
My test view which I have verified has the correct url is never called, I have set break points and nothing happens, I am alerting the url on the client side before I make the ajax call and it should match what I have defined in my urls.py.
def teset_view(request, username):
template = 'profiles_view.html'
return render_to_response(template,
context_instance=RequestContext(request))
Have I missed something simple?
UPDATE:
I added the error to see if it would error and I receive this alert, how can I figure out why jquery errors like this. I don't have any other conflicting places where I would cross reference
It looks like I am running into a jqXHR status always returning zero
error: function(jqXHR, exception) {
if (jqXHR.status === 0) {
alert('Not connect.\n Verify Network.');
}
What can I do to fix this, I have tried adding a e.preventDefault
at the end of the on click method
UPDATE
My url is set up this way
url(r'^profiles/(?P<username>[\w.@+-]+)/$','Taleebo.views.profiles_view',name="profiles"),
, i have added the getCookie() javascript safe method so i can make proper ajax request.