I am pretty new with Client side code and completely clueless when it comes to server-side (Django, in particular). What I am attempting to do is click a button which sends a get request to the server, and then posts it on the page (using jGlideMenu).
I know the code should look something like the following:
$('#clickID').click(function(){
$.ajax({
url:"someURLGoesHere",
type: 'GET',
success: function(data){
$('#someEl_2').html(data)
},
dataType: JSON
});
});
I have no idea what to use for the URL. Do I need to refer to the url.py file? views.py? models.py? Maybe a particular var inside one of those files? Also do I need to use relative directories?
All the tutorials I found use PHP instead so I am not sure if it is the same. Please help!
You put in whatever URL you have setup to go to the appropriate function to process the data in the views.py file. If you have this in your urls.py:
url(r'^/testing$','proj.app.testing')you would put in'/testing'for your ajax request.