Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 237529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:25:57+00:00 2026-05-11T20:25:57+00:00

I have some links on an html page like , , currently I handle

  • 0

I have some links on an html page like , , currently I handle them as so

<p> <a href="/cases/{{case.id}}/case_rate/-">rate down</a>

and have a url.py entry:

 (r'^cases/(?P<case_id>\d+)/case_rate/(?P<oper>.)$', 'mysite.cases.views.case_rate'),

then I have a view function that handles the logic and hits the DB, then does this:

return HttpResponseRedirect(request.META.get('HTTP_REFERER','/'))

I’s there a better way to do this? I can see how this would be OK because it does have to redraw the screen to show the new rating…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:25:57+00:00Added an answer on May 11, 2026 at 8:25 pm

    The typical way to handle this is with an ajax request.

    Instead of a link, you put a javascript handler that calls a view, wich updates the db, and returns a json / xml object with the new rating for the item. Then another javascript handle receives that response and updates the rating number on the screen, without a page reload.

    Ideally, you’ll keep both versions: plain html (the one you currently have) and the ajax one. The ajax one can be attach to the element after page load, so if javascript is not available, you’ll still have a working site.

    Then, regarding organization, you can have an “ajax” parameter on your view. The view should update the db accordingly, and if it’s an ajax call, return the json / xml response, otherwise, return the new page. That way you can keep the logic (fetching the object, updating the db) on one place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some nav links like so: <ul id=nav> <li><a href=index.html>Home</a> <li><a href=about.html>About</a> <li><a
I have a PHP page which looks through some HTML for links and replaces
I have some text that has HTML hyper-links in it. I want to remove
I have the following HTML <p>Some text <a title=link href=http://link.com/ target=_blank>my link</a> more text
I have some jQuery code that intercepts links clicked on a page: $(document).ready(function() {
I have a HAML page that lists some links to delete things that looks
I have a overview page containing a list with some links from which multiple
I have a LI with some information, including some links. I would like jQuery
I currently have page-specific javascript files that look something like: $(document).ready(function () { namespace.home.list
I've the current situation: Have a Link in some HTML page. When the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.