We should be utilizing separate AJAX urls for this instead to keep this view more readable and so we can split the code up into some semblance of tradititional Django views. For each of these, conditional statements, we should add a URL path in myprofile/urls.py. Then, in the corresponding AJAX function, we set the URL (instead of leaving it as an empty string like we do right now). You can see an example of this kind of architecture with the infinite scroll ajax for viewing the feed (check myprofile/urls.py, the more_feed_results view in this file, and the static/pager.js ajax call). Doing this, we can eliminate these conditionals completely and not have to append an action parameter to the post data.