Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

rails ajax call to controller method loading code example

Example 1: $.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

Example 2: $.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);
  }
})

Tags:

Javascript Example

Related

electron bworserwindow disable scroll code example get day of date postgresql code example make a notepad with python code example making a mysql connection in react js code example change background color with buttons in javascript code example http response codes deleted code example how to get session using javascript code example python getattr what for code example ftp keep modified date in python code example java -jar files location code example get thumbnail image url in wordpress code example php and sign code example

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy