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

234
Visualizações
Jquery to change form action and, Pass user id through action

I have a modal where a user fill the data and when user press the submit button, a id fetch from jQuery and save data in datable according to the user id. So, I have to fetch the id from jQuery and have to pass through PHP variable.

Here is my query for changing my form URL:

$('#get_form').attr('action', '{{ url("admin/report/update/"."$id="obj.data('id'))" }}');

And, here is my form

<form action="" id = "get_form" method="post" class="ajax-form modal-content" enctype="multipart/form-data">

I am unable to set the URL perfectly.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You're mixing blade with js. Try formatting the url like this:

const url = "{{ url('admin/report/update/:id') }}".replace(':id', obj.data('id'))
// generates admin/report/update/1 assuming obj.data('id') is equal to 1

$('#get_form').attr('action', url);
over 4 years ago · Santiago Trujillo Relatório

0

 var id = $('some-id').val();  // a hidden value

 var url = "{{ url('admin/report/update/') }}" + id;

 $('#get_form').attr('action', url);
over 4 years ago · Santiago Trujillo Relatório
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