2

i am having the following function call and function definition in xyz.js.erb file. but the function is not calling.

    merge_cells();

    function merge_cells() {  

    }

1 Answer 1

1

Writing javascript function definition in js.erb file is not a good way. You can move that function to application.js file

Sign up to request clarification or add additional context in comments.

2 Comments

when i include this <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> library in my xyz.js.erb file, then the method is calling. but this link i added to the view page already which is got some stuff used by the xyz.js.erb file.
You can send the response using instance variable and you can use this variable on your erb template. For more understanding here is a good explanation. stackoverflow.com/questions/18595739/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.