Skip to content

Instantly share code, notes, and snippets.

@renjithsraj
Created October 16, 2017 11:47
Show Gist options
  • Save renjithsraj/110d134bb3c07dfa52911b5e14ed9373 to your computer and use it in GitHub Desktop.
Save renjithsraj/110d134bb3c07dfa52911b5e14ed9373 to your computer and use it in GitHub Desktop.
$(document).ready(function(){
$("#your-dropdown-id").change(function(){
var drid = $(this).val();
$.ajax({
url: 'getUsers.php',
type: 'post',
data: {value:drid},
dataType: 'json',
success:function(response){
// add the json response into html values
}
}
});
});
});
@csrf_exaampt
def ajax_view():
response = {}
if request.POST and request.is_ajax():
print (request.POST)
# get the value from post
# make json value
return HttpResponse(json.dumps(response))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment