Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

173
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda