This is my request in ajax,
var req=$.ajax({
type: "POST",
url: '/create/travel', // or just url: "/my-url/path/"
data: {
csrfmiddlewaretoken: document.getElementsByName('csrfmiddlewaretoken')[0].value,
startPlace:nameStart,
startLng:lngStart,
startLat:latStart,
endPlace:nameEnd,
...
}
});
Then, it is my view
def createT(request):
if request.is_ajax():
#print(request.POST['board'])
print(Car.objects.get(number_plate=request.POST['number_plate']))
travel1=Travel.objects.create(
name=request.POST['name_travel'],
startPlace=request.POST['startPlace'],
...
)
return render_to_response('travel/meTravel.html',{},context_instance=RequestContext(request))
But django not go to the template, i dont know how i go to other view or open other page, other template,
Simply when i come to this view, i cannot open other view, single django stay in the same page. =$
Help me! Tanks ,