Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

$.ajax how to read data vale in controller in rails

def test
  some_parameter = params[:some_parameter]
  # do something with some_parameter and return the results

  @test=books.find.last
  respond_do |format|
    format.html
    format.json {render json: @test}
  end
end
Comment

$.ajax how to read data vale in controller in rails

$.ajax({
  type:"GET",
  url:"books/test",
  dataType:"json",
  data: {some_parameter: 'hello'},
  success:function(result){
    alert(result);
  }
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript alert variable 
Javascript :: import npm module node.js 
Javascript :: multipart/form-data ajax jquery 
Javascript :: react functional components shortcut in webstorm 
Javascript :: javascript console 
Javascript :: axios set request header 
Javascript :: regex char or char 
Javascript :: momentjs docs 
Javascript :: Saving values for metaboxes in wordpress 
Javascript :: vue router url string 
Javascript :: how to use json stringify in javascript 
Javascript :: knex.js migration create 
Javascript :: react-slick 
Javascript :: react router reload page not found 
Javascript :: responseText js 
Javascript :: material ui 
Javascript :: function to count words in string 
Javascript :: nullish coalescing operator 
Javascript :: concat multiple arrays in javascript 
Javascript :: multi dimensional array javascript 
Javascript :: js array includes multiple items 
Javascript :: shift and unshift js 
Javascript :: what is $ in jquery 
Javascript :: javascript string add new line 
Javascript :: capitalize first letter in array of strings javascript 
Javascript :: react white screen 
Javascript :: extract text from a string javascript 
Javascript :: AJAX JAVASCRIPT FUNCTION CALLS 
Javascript :: angular ng class with animation 
Javascript :: trigger a button click with javascript on the enter key in a text box 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =