JavaScript Is it possible to send a javascript variable to the create method of a controller?

First verify that you have:

  • gem 'jquery-rails' in your Gemfile
  • //= require jquery in your application.js

second your data has a , that should be removed:

$.ajax({
  url: "/register",
  type: "POST",
  dataType: "json",
  data: {
       authenticity_token: $('meta[name=csrf-token]').attr('content'),
       funds: funds,
       weight: weight
  },
  complete: function(){
       console.log('Congrats');
  }

});

you can place as many parameters as necessary in the ajax data parameter.

Let us know if you need more help

Answer:1

Does anyone know why this happens? Placing an image and then setting a setInterval function to animate it. Then adding HTML to the parent div breaks the animation. document.getElementById('whiteboard'...

Does anyone know why this happens? Placing an image and then setting a setInterval function to animate it. Then adding HTML to the parent div breaks the animation. document.getElementById('whiteboard'...

I'm trying to code an exercise in html page with javascript, to calculate the mean of a random array of 6 numbers that generated from randomArray() function. After the first loading of the page and ...

I'm trying to code an exercise in html page with javascript, to calculate the mean of a random array of 6 numbers that generated from randomArray() function. After the first loading of the page and ...

  1. pass values from child to parent react
  2. pass values from view to controller mvc
  3. pass values from powerapps to flow
  4. pass values from html to javascript
  5. pass values from view to controller
  6. pass values from parent to child angular
  7. pass values from javascript to php
  8. pass values from lightning component to flow
  9. pass values from html to php
  10. pass values from activity to fragment
  11. pass values from aura to lwc
  12. pass values from html to html
  13. pass values from servlet to jsp
  14. pass values from jsp to java class
  15. pass values from js to html
  16. pass values from fragment to fragment android

I need a horizontal scroll bar for twitter timeline,as of now the options provided by twitter API is vertical scroll bar or no scroll bar,how can i achieve this? Code used: <DIV class="twit"> ...

I need a horizontal scroll bar for twitter timeline,as of now the options provided by twitter API is vertical scroll bar or no scroll bar,how can i achieve this? Code used: <DIV class="twit"> ...

I'm having trouble to create image slideshow. An image fetched from data base and binded into view model. it working fine. now i want to create slideshow with available images. i had tried like this. ...

I'm having trouble to create image slideshow. An image fetched from data base and binded into view model. it working fine. now i want to create slideshow with available images. i had tried like this. ...