Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

264
Views
How to tell ajax to run particular URL only when a pop up banner is clicked?

I am trying to pop-up a feedback banner, when a particular page is loaded. Here is the code for that.

$(window).on('load', function() {
    $('#review_modal').modal('show');
});

Now I want if someone clicks any button of pop up banner, (either Give feedback or No thanks) it runs a particular URL which only does is (Never show that user feedback again)

Here is my code for that which is wrong.

$(window).on('click', function() {
        $.ajax({
            type: "POST",
            url: "/update_feedback_status",
        });
    });

I am very very new to ajax, but I need this to be done as soon as possible. How should I fix it? HO wto tell ajax that On click means clicking on the button of that popup banner which is #reviewmodal.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You should add the click event listener to the elements in popup model instead of window.

For example:

<div id="review_modal" class="modal">
    <button>Give feedback</button>
    <button>No thanks</button>
</div>

<script>
$('#review_modal button').on('click', function() {
    $.ajax({
        type: "POST",
        url: "/update_feedback_status",
    });
});
</script>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!