Transfer data from an Hidden input to a route

Asked

Viewed 28 times

0

I have the score function of a control with the following code :

public function score($ids, $points) { $score = Team::find($ids)->increment('points', $points) ;

The $ids field will receive several id’s that I am writing to an Hidden input. The idea is to take the id and increase the score of those who are in the input. For example, it will have 3,4,6,10. I load the points from another controller, simply declaring $quest->points. How do I pass these two parameters using a button?

  • Are you passing this from a form? Ever tried to put the button with type Submit?

  • I’m trying to pass without using form. I want to use like this: {{route('team.score',input_ids,$question->points)}}. This input_ids is the Hidden input with the id’s that will be incremented

  • Are you using something else? Like a jquery?

  • Exactly. How do I do this via jquery?

  • Then convert the button to href and add the btn class and attributes data-id=$id and data-question=$points from there you can do the sending with ajax

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.