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 7058143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:04:39+00:00 2026-05-28T04:04:39+00:00

I am in the process of rewriting a website in Coffeescript and I am

  • 0

I am in the process of rewriting a website in Coffeescript and I am having trouble with some very nooby errors. I know it is probably a very simple answer, but I’ve been stuck on this for quite some time so decided to post.

Here is my code:

$ ->
    rankings = new Rankings
    $('.filter').click ->
        #highlighting filter on click
        if $(this).hasClass('genre-filter')
            rankings.filters.set('genre', $(this).html().toLowerCase())
        else   
            rankings.filters.set('time', $(this).html().toLowerCase())
        #todo: add loading screen to rankings here
        #ajax post
        $.post '../history/ajax/rankingsajax.php',
            genrefilter: rankings.filt('genre')
            timefilter: rankings.filt('time')
            artistfilter: rankings.filt('artist')
            userfilter: rankings.filt('user')
            (data) ->
                alert data

No matter how I try and fiddle with it, it always ends up alerting a blank pop-up window. So I thought I’d try a simpler example and just use a get request. I tried the following:

    $.get '../index.html', (data) -> alert data

However, this also results in a blank pop-up window.

The the above code compiles correctly to JS so I am lost as to where to begin. Any help is appreciated.

-Calvin

  • 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-28T04:04:39+00:00Added an answer on May 28, 2026 at 4:04 am

    Don’t be afraid to use curly braces and parenthesis. They’re not required, but they can help clarify what’s going on.

    $ ->
        rankings = new Rankings
        $('.filter').click ->
            #highlighting filter on click
            if $(this).hasClass('genre-filter')
                rankings.filters.set('genre', $(this).html().toLowerCase())
            else   
                rankings.filters.set('time', $(this).html().toLowerCase())
            #todo: add loading screen to rankings here
            #ajax post
            $.post '../history/ajax/rankingsajax.php', {
                genrefilter: rankings.filt('genre')
                timefilter: rankings.filt('time')
                artistfilter: rankings.filt('artist')
                userfilter: rankings.filt('user')
            }, (data) -> console.log(data)
    

    The blank popup at least lets you know you’re getting to the success callback, which is good. So maybe check that you’re calling the correct url. I noticed you’re using a relative path, ../history/ajax/rankingsajax.php, make sure that path is relative to the HTML page that is using the JavaScript and not the JavaScript file itself.

    Instead of alert(data), I would use console.log(data) and use Firebug or the JS console in Chrome and Safari to see what’s going on. The console provides more information than an alert.

    Good luck,
    Sandro

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

Sidebar

Related Questions

We are in the process of rewriting some of our websites and trying to
I am rewriting some old JavaScript with jQuery and would like to know how
I'm in the process of rewriting a web application (i.e. not web page, but
I am in the process of rewriting an Access database and I have some
I am in the process of re-writing some very outdated .NET 2.0 SOAP web
We are in the process of rewriting a large legacy system that makes extensive
My company is in the process of rewriting our software from scratch, and I'm
I am currently in the process of rewriting an application whereby teachers can plan
I'm in the process of rewriting the error handling of PEAR's Text_LanguageDetect to exceptions
I am in the process of rewriting a bottle neck in the code of

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.