Drew Rush
Drew Rush

Reputation: 720

jQuery Rails - .post Data

Here is the code in my application.js file:

  this.change(function() {
    $.post("dvbd", {id: this.val()}, null, "script");
  });

Here is what is in dvbd.js.erb:

$("#dave").html(:id);

What I'm trying to do is when this changes, the dave div has the value of this as its html. So I guess my question is how would I use the data sent using .post in my js.erb file?

Upvotes: 0

Views: 97

Answers (1)

lee
lee

Reputation: 2439

$("#dave").html("<%= params[:id] %>");

Upvotes: 1

Related Questions