On Tue, Nov 27, 2012 at 12:44 PM, nikhil rn [email protected]
wrote:
Jim,
I am using firefox 11. I am afraid I cant change my browser. And sorry,
how do I look for the js errors? I got nothing in the log file.
install firebug. after installing firebug, open the firebug console and
reload
the page. you should see the js errors on firebug after that.
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.
–
Jim,
If I put in prototype, my jquery doesnt work. So can i remove prototype?
And yes Ill install FIREBUG.
Nikhil
On Tue, Nov 27, 2012 at 1:01 PM, nikhil rn [email protected] wrote:
Hey Guys, let me explain you all my scenario where I am stuck.
I got a table filled with cells. When I right click on any cell, I got
to display a context menu and then call a controller method on left
clicking the context menu. I got to send in a parameter to my controller
code and return what controller sends back. I am using jquery right
you’re using both prototype and jquery? why do you need both of them?
currentCellText = $(this).text();
},
alert(val);
And my controller code is
–
You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.
–
On Tue, Nov 27, 2012 at 1:43 PM, nikhil rn [email protected] wrote:
Jim,
If I put in prototype, my jquery doesnt work. So can i remove prototype?
And yes Ill install FIREBUG.
yes. remove prototype. they have conflict since they both use $.
there’s
a way around this but if you don’t need both of them, it’d make your
life
easier.
Look at jQuery.ajax() | jQuery API Documentation for implementing ajax on
jquery
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.
–
Colin,
I have installed firebug for my Browser and after I left click my
right click menu option, I get the alert in the firebug console. No
errors there too. But how do I call the controller method?
Nikhil
Jim,
I have removed the prototype.js file from app/assets/javascripts
folder. I will look into the link which you have posted.
Thanks,
Nikhil
On Nov 27, 2012, at 12:54 AM, nikhil rn wrote:
Jim,
I have removed the prototype.js file from app/assets/javascripts
folder. I will look into the link which you have posted.
Thanks,
Nikhil
The script that you posted originally was written using Prototype
conventions, not jQuery. If you substitute jQuery for Prototype, you
also need to alter your code to be jQuery-compliant.
Now if you have more Prototype than jQuery in your hand-written code,
you can make Rails use Prototype in place of jQuery for all of its core
unobtrusive functions (:remote => true and so forth). Just make sure you
have the proper (prototype) version of rails.js in your project, and
only include prototype.js (not both prototype.js and jquery.js) in your
application.html.erb template. Make a scratch Rails project with:
rails new foo -j=prototype
Have a look in that project for the relevant files.
Walter
Colin,
I have not put any javascript in application.js. If I have to put
any, what should that script be trying acheive?
Nikhil
Walter,
I will change the prototype to jquery. Thanks.
Nikhil
Finally got it working. I thank you all for your support, time and
patience.
$(document).ready(function() {
var currentCellText;/this variable will have the clicked cell value/
$(“tbody td”).mousedown(function(e) {
currentCellText = $(this).text();
});
$.contextMenu({
selector: '.context-menu-one',
callback: function(key, options) {
var m = "clicked: " + currentCellText;
window.console && console.log(m)||
test_call(currentCellText);
},
items: {
“Menu 1”: {name: “Menu 1”},
“Menu 2”: {name: “Menu 2”},
}
});
});
function test_call(val)
{
$.ajax({
type: ‘GET’,
url:’/leave’,
data:{ foo: val },
success:function(data){
alert(data);
}
});
}
Nikhil