dimanche 3 mai 2015

Interpolating and pass Argument

I want to interpolate my Javascript Code with a Ruby Function. For example:

def find_house name
   ......
end

def map_houses
 %{
    function() {
       var name = this.name;
       var house_data = #{find_house(this.name)};
       ............
     }
  }
end

But, it doesn't work like this, i get an error for this line:

 var house_data = #{find_house(this.name)};

It says this.name is Undefinded.

How can I pass a javascript argument to this function? Thanks

Aucun commentaire:

Enregistrer un commentaire