Displaying 20 results from an estimated 3000 matches similar to: "Problem with escape_javascript in 3.0.9rc1"
2011 Sep 10
4
Finding HTML attributes with jQuery in Rails 3.1
I''m having trouble wrapping my head around the proper syntax to have
jQuery (in an .js file) grab an HTML attribute and use the value of
that attribute to load a partial.
HTML fragment:
<a href="/toggle" data-remote="true" section="training">
jQuery string (now setting a static partial, I need this to be
dynamic)
2009 Sep 04
2
escape_javascript error
Hello,
I am using jQuery for all ajax stuff and recently got following error:
ActionView::TemplateError (private method `gsub'' called for #<Array:
0x2425ae8>) on line #1 of...
and the code where it happens:
$("#notice_ajax").before(''<div id="notice_ajax"><%= escape_javascript
(flash.delete(:notice)) %></div>'').remove();
2012 Aug 07
4
how to do render partial on jquery ajax success method with rails 3
I''m using rails 3.2.1 with jquery for an ajax call.
My juqery code is :
jQuery.ajax({
url: "/org_pages",
data: ''org_id=''+ org_id,
type: "POST",
success: function(result){
jQuery("#image_center").html("<%=
escape_javascript(render(:partial =>
2010 Dec 21
8
Rails - escape_javascript without all the \n\n\n\n\n
Hello, I''m using escape_javascript to return a partial to the browser
via ajax.
Something like:
$("#inject").html("<%=escape_javascript(render :partial =>"feed/
index")%>");
Problem is escape_javascript ends up outputing all kinds of wasted
space like
\n\n\n\n\n \n
Is there anyway in Rails to escape_javascript more
2010 Sep 27
9
Rails 3 - Creating a comment and then returning the Partial with JUST the new comment
Here''s the flow I have...
First, jquery posts the new comment to the server:
$.post(this.action,$(this).serialize(),null,''script'');
Then in the comments controller:
def create
@comment = lots of stuff going on here but it works...
if @comment.save
flash[:notice] = "Successfully created comment."
2006 May 19
1
how to access ActionView::Helpers::JavaScriptHelper::escape_javascript in a model (a newbie question)
Hi all,
Please forgive me for this newbie question. But I really want to know how
how to access ActionView::Helpers::JavaScriptHelper::escape_javascript
method in a model.
I can access this method in view, but when call it in the model, it ends up
with undefined method.
It seems to me they are in different scope.
So what''s the best way to access view helper methods in model.
--
2012 Feb 29
4
how to use link_to with :remote=>true in rails 3.2.1
I m using Rails 3.2.1. how to use link_to with remote=>true
--------------------------------------------
My Method in Controller
def clickme
@clk = "you click me"
respond_to do |format|
format.js { render :layout=>false }
end
end
--------------------------------------------
My View
In my new.html.erb file
<%= link_to "click here",
2011 Nov 10
1
Auto populate text_fields based on selected item from another collection_select
Hello people
I''m trying to figured this out, but I still can''t do it.
I have a rails 3 app, I''m working with invoices and payments. In the
form for payments I have a collection_select where I display all the
invoices number (extracted from a postgres database), and what I''m
trying to do is when i select an invoice autopopulate others
text_fields (provider,
2010 Sep 27
6
Rails 3 + jQuery ; How to show error messages
Hi guys,
can anyone explain how to show error_messages_on (like back in Rails
2 , without Ajax) fields that didnt'' pass the validation the jquery
way.
I googled for about 2 hours now and found nothing. Jquery works fine
and adds the content to my table, but im totally stuck with the whole
error/validation thing.
My form looks like this:
<%= form_for Translation.new , :remote =>
2009 Aug 23
0
Best way of moving some jQuery from a view helper
I have a helper that uses some jQuery code that I would like to move out
of the helper method.
I am trying to move it to application.js but it will probably end up in
a different file.
I have two reasons for wanting to do this.
1) I want to keep all my jQuery code seperate to my HTML code
2) I want to change the append to an appendTo so I can add a highlight
effect, appendTo which is proving
2012 Jan 05
8
js update partial missing template
PermissionsController
def add_member
...snip...
@permissions = Permission.all
respond_to do |format|
format.html {
flash[:messages1] = @permission.user.name + " has been given rights."
}
format.js
end
end
app/views/permissions/add_member.js.erb
$(''#privileges'').replaceWith("<%=
2009 Jun 03
3
Appending a Rails Partial with jQuery
Im not sure which group to post in, so i thought i''d try both. Any
Rails peeps that use jQuery? Im having a problem.
I have followed Ryan Bates Screencast about inserting a partial with
jQuery and currently have it working in my app. What i really would
like is to keep all my code in my application.js file vs a bunch of
files all over my view folders.
This is what i have in my
2010 Apr 30
1
render_to_string problem
i have a scenario where a jquery is receiving a response in the string and
which content html component like "<div id=\"test\">test</div>" ideally in a
view it should display only "test" but it displaying entire string <div
id="test">test</div> is there any way i am deal with the problem through js
or rails?
Thanks
abhis
--
You
2009 Mar 30
0
Trying to bind an appended partial that has REST_in_place attached to it with jquery?
In my create.js.erb view I am creating a new model in the view. On
creation I want to have the appended partial in the dom and
selectable
so I can click it''s name and run the plugin REST in place with
Jquery.
#create.js.erb
$("#new_show").before(''<div id="flash_notice"><%= escape_javascript
(flash.delete(:notice)) %></div>'');
2011 May 25
1
trouble using jQuery in Rails 3.0.7
I''ve tried to install JQuery a couple of times now, and I''ve followed
the steps for Rails UJS mentioned here:
https://github.com/rails/jquery-ujs
The last time I went ahead and added jQuery UI as well:
$ rails generate jquery:install --ui
remove public/javascripts/prototype.js
remove public/javascripts/effects.js
remove public/javascripts/dragdrop.js
2011 Nov 03
0
multiple render text in jquery rails
Hi,
For one action of user based on condition i want to render different
texts. So how do i achieve it through jquery?
For example:
A simple posting message application:
On post button i have a post method which has security checks and other
server side checks like :
===========================
if message_text.nil? or message_text.empty? or message_text.length > 140
2011 Dec 13
1
continuous jquery partial update
Rails 3.1.x - jquery
drag_drop.js
$(function() {
$( "[id^=moveable]" ).draggable();
$( "#droppable2" ).droppable({
drop: function( event, ui ) {
$( this )
.addClass( "ui-state-highlight" )
$.post( "groups/add_member/", { "add": ui.draggable.text() }, function(data) {
2012 Jun 28
2
Best practice on Javascript and rails
Hi, I get constantly nervy whenever trying to implement any javascript /
jquery in rails, basically because I''m not sure where to put things in
the project!
I know the people at rails have thought long and hard about how to best
structure an app, so I''d like to learn the correct way.
I''m using rails 3.2, ruby 1.9.3
/////////////
1st situation - using a gem to include
2010 Jun 02
1
Ajax with JQuery
I have used Ajax link and live validation in index.rhtml
Ajax link requires JavaScript "prototype" and live validation requires
"jquery".
i got "element.dispatchEvent is not a function" on the firebug console
when i used "prototype" and "jquery" in same page index.rhtml
after i removed javascript "prototype" library, i got "Ajax is
2011 Aug 10
3
javascript_include_tag error
<!DOCTYPE html>
<html>
<head>
<title><%= @title %></title>
<%= csrf_meta_tag %>
<%= javascript_include_tag
"http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js",
"jquery.rails.js"
%>
<script type="text/javascript">
...app/views/layouts/application.html.erb:7: syntax error, unexpected