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

180
Views
How to properly pass values through in jquery / ajax calls

I've been creating a web app and one example of something it does is create golf rounds. Everything I've done works but I have been doing some testing and the way im passing variables through to my ajax call means the user could update anyone's round.

Currently I have a table that shows you your round and you can select the view button which will open a modal form to show details of that round.

This is my HTML

<button
  type="button"
  id="view-round"
  class="btn btn-outline-primary btn-square btn-skew pull-right" 
  attr-id="39"
>View</button>

This is my jquery

$('body').on('click', '#view-round', function () {
    var id = $(this).attr('attr-id');
    $.post('/dashboard/pages/golf/round/ajax.php?action=load', {id: id}, function(response) {
      //code in here
    }
   });

You can see from this that I'm passing through the round id via the attribute on the button "attr-id".

What I'm asking is can I put this variable somewhere someone couldn't edit it via the developer console etc.

I'm currently changing the ajax calls so that you can only update/look at your own records but really I'd like to stop it from being changed all together.

about 4 years ago · Juan Pablo Isaza
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!