Skip to content

Instantly share code, notes, and snippets.

@coffeejay
Created January 6, 2015 19:09
Show Gist options
  • Select an option

  • Save coffeejay/08b1a1ec0bce690bcb61 to your computer and use it in GitHub Desktop.

Select an option

Save coffeejay/08b1a1ec0bce690bcb61 to your computer and use it in GitHub Desktop.
$.ajax({
url: "<%= portfolios_calculate_path %>", // Route to the Script Controller method
type: "GET",
dataType: "json",
data: portfolio_data, // This goes to Controller in params hash, i.e. params[:file_name]
complete: function() {},
success: function(data, textStatus, xhr) {
// Do something with the response here
alert("it worked!"); // Show the file contents in our editor.
},
error: function(error) {
alert("Ajax error!" + error)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment