Rails and Jquery

Hellow, I have such problem. So I have usual .js.erb template, which is
called from controller with format.js
This template is just for testing now, so only calls alert message, if
some
links are clicked. I didn’t modified default layout document.
The problem is that on first click nothing happens, than it alerts as
many
times, as all links was clicked until this moment.
So 1st time click - zero alerts, 2 time click - 1 alert, 3 time click -
2
alerts and so on.
The code of Jquery file is so simple, that definetely not the source of
problem.
May be some ideas?

On 12 March 2013 22:50, Barry [email protected] wrote:

Hellow, I have such problem. So I have usual .js.erb template, which is
called from controller with format.js
This template is just for testing now, so only calls alert message, if some
links are clicked. I didn’t modified default layout document.
The problem is that on first click nothing happens, than it alerts as many
times, as all links was clicked until this moment.
So 1st time click - zero alerts, 2 time click - 1 alert, 3 time click - 2
alerts and so on.
The code of Jquery file is so simple, that definetely not the source of
problem.

Well since the rest of the code is so simple it can’t be that either,
I assume. The obvious conclusion is that it is working correctly.

Have a look at the rails guide on debugging which will give you
techniques that you can use to debug the code. The first thing to do
is to work out where it is failing so you can look in the log to see
what actions are being called at what points and you can debug the
data you are passing up to the view to see if that is ok.

Once you have worked out which bit of code is failing you will
probably see the problem, if not then come back and show us the code
that is failing (not the whole app, just the bit that is failing).

Colin

Colin L. wrote in post #1101662:

Well since the rest of the code is so simple it can’t be that either,
I assume. The obvious conclusion is that it is working correctly.

Have a look at the rails guide on debugging which will give you
techniques that you can use to debug the code. The first thing to do
is to work out where it is failing so you can look in the log to see
what actions are being called at what points and you can debug the
data you are passing up to the view to see if that is ok.

Once you have worked out which bit of code is failing you will
probably see the problem, if not then come back and show us the code
that is failing (not the whole app, just the bit that is failing).

Colin

@Colin, FYI: I’m pretty sure this is a duplicate of another thread,
which has been resolved.

On 14 March 2013 19:55, Robert W. [email protected] wrote:

Once you have worked out which bit of code is failing you will
probably see the problem, if not then come back and show us the code
that is failing (not the whole app, just the bit that is failing).

Colin

@Colin, FYI: I’m pretty sure this is a duplicate of another thread,
which has been resolved.

OK, thanks. I must have missed it.

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs