Displaying 14 results from an estimated 14 matches for "beforesend".
2012 Mar 07
1
link_to with :remote=>true works when bound to "click" but not "ajax:beforeSend"
Hi. I am trying to do an ajax link in Rails 3.2.1 and jQuery. I am
loading jquery.js and jquery_ujs.js. In my document ready, if I bind
to the event "click," clicking the link fires an event, but if I click
to ajax:beforeSend, it doesn''t. Nothing happens when you click the
link in JQuery. The event does go to the controller, though.
Works:
$(document).ready(function(){
$(''.approve-item'').bind("click", function(evt, xhr, settings){
alert(''click'');
}...
2013 Sep 19
0
CRUD model in a bootstrap modal with jquery, ajax - best practice
...to do it? all the mix between script and json format
and the partial html inside the json doesn''t feel right.
This is the ajax for the form submit:
$(''#dialog'').on(''submit'', ->
$(this).find(''form'').unbind(''ajax:beforeSend'').bind(''ajax:beforeSend'',(evt,
xhr, settings) ->
).unbind(''ajax:success'').bind(''ajax:success'',(evt, data, status, xhr) ->
#insert Data to selectbox it there comes a type attribute with the
request
if xhr.status ==...
2013 Jan 09
4
CSRF resets my session in Firefox
Hello all,
I''ve been trying to diagnose an issue with CSRF and Firefox
specifically. I''ve got an ajax based form, using UJS (yes, I have
csrf_meta_tag in my layout and I''ve tried adding the X-CSRF-Token header
to the ajax beforeSend events without any luck)... The form just posts
some data to an ajax method that creates, saves, and sets the session
for a shopper as well as for a hit object, then returns some JSON. This
works in Chrome and Safari (haven''t tested IE yet), but Firefox is a
no-go. Basically, the session g...
2008 Sep 25
2
jquery, format.js and IE
...;'s
not a real AJAX request, and I''m using the jQuery Form plugin to post to
an iframe.
The details of my ajax call:
var options = {
url: /pictures/1.js,
iframe: true,
beforeSubmit: prepImageArea,
success: imageUploaded,
dataType: ''script'',
beforeSend: function(xhr) {xhr.setRequestHeader("Accept",
"text/javascript")}
}
And my respond_to block:
respond_to do |format|
format.html { redirect_to edit_picture_path(@picture) }
format.js { render :json => @picture.to_json(:methods =>
[:public_filename...
2010 Sep 23
8
HowTo; Rails 3, having Tabs that load content via jQuery ... No Page Refesh
Hello, I''m interested in learning the correct/smart approach for
implementing a web page with tabs and a content panel... When the tab
is clicked by the user the tab''s content is fetched and inserted with
jQuery... no page refresh...
Example, Facebook, when you click Photos or Events, it doesn''t refresh
the browser, just replaces the content with AJAX in the
2010 Jul 06
0
Rails 3: link_to :remote => true with spinner
How is this most efficiently done? link_to_remote is gone.
I am using jQuery and am wondering how I could bind beforeSend call back
with my link_to :remote => true call. So that I can use it to draw
spinner.
Sharkie
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rub...
2010 Nov 06
0
Rails and JQuery and Ajax/Json question
Hi,
I am using JQuery in my rails app. I''ve taken the approach outlined
in Ryan Bates''s Railscast on jquery to do the following:
jQuery.ajaxSetup({
''beforeSend'' : function(xhr) {xhr.setRequestHeader("Accept",
"text/javascript")}
});
to set my ajax call request Headers to text/javascript so that my
respond to block for javascript is invoked.
This works great up until I get to wanting to call jQuery.getJSON
It appears that my...
2013 Jan 16
0
Rails 3.2 jQuery JSONP request not working - Moved Permanently
...t;/administration/dashboards/remove_tag_named.json"
type: "POST"
dataType: "json"
contentType: "json"
data: {"tag_name": tagName }
success: (result) ->
selected.remove()
I have also set an init js
$.ajaxSetup beforeSend: (xhr) ->
xhr.setRequestHeader "X-CSRF-Token",
$("meta[name=\"csrf-token\"]").attr("content")
and the console output :
[23:18:24.424] POST
http://localhost:3000/fr/administration/dashboards/remove_tag_named.json
[HTTP/1.1 301 Moved Permanently 46m...
2011 Jun 12
3
What is someone trying to do?
....test: 1 Time(s)
/lib/js/T.test: 1 Time(s)
/lib/js/a&&a.type: 1 Time(s)
/lib/js/a,b,this.handle.elem: 1 Time(s)
/lib/js/a.call: 1 Time(s)
/lib/js/a.nodeType===1&&a!==b&&d.push: 1 Time(s)
/lib/js/a.style.display=c.data: 1 Time(s)
/lib/js/b&&b.type: 1 Time(s)
/lib/js/b.beforeSend&&b.beforeSend.call: 1 Time(s)
/lib/js/b.data: 1 Time(s)
/lib/js/b.data&&T.test: 1 Time(s)
/lib/js/b.map: 1 Time(s)
/lib/js/b.type: 1 Time(s)
/lib/js/b.url: 1 Time(s)
/lib/js/b.url;if(!d)%7Bvar: 1 Time(s)
/lib/js/b===b.ownerDocument.body: 1 Time(s)
/lib/js/b=b.call: 1 Time(s)
/lib/js...
2012 Feb 27
6
selecting params value to use with $.ajax()
Hello all,
I''m trying to write a jquery function where I am posting some data from a
form. I am wondering is there a way to select the particular param that I
want to use when I submit the data to $.ajax(). I don''t believe it makes
sense to create a hidden field just to use with $.ajax() but I can''t seem
to figure out how to get to the params key/value using jquery.
2009 Aug 23
4
Routing problems for different formats
I am having 2 similar problems with routing.
1. With Rails if I make a js request using jQuery I always have to
append a ".js" extension to allow the request to be handled
appropriately. If I don''t append a js extension I get html formatted
data back. Using Merb this never happened and worked like I thought it
should.
2. Today I am having problems allowing xml requests to be
2009 Feb 22
8
dynamically changing a form from POST/CREATE to PUT/UPDATE
For the life of me I can''t figure this one out, although I can''t find
anyone else who''s attempted to do this, and probably with good reason.
Context: blog using AJAX
What I''m trying to do: when the user initially saves a blog entry, or
when auto-saving, I want subsequent saves to not create a new blog
entry
Why I can''t just reload the partial:
-
2007 Apr 28
6
RESTful web service tutorial?
Hi,
I would like to turn some of our simulation codes
out to pasture and string some of them together
by draping them in web services.
I''m looking for a RESTful Camping tutorial to get
started ... pointers appreciated.
Some simple example applications:
airfoil force calculator: feed it an airfoil
geometry, an angle of attack, and a Mach number,
and it returns the lift, drag, and
2011 May 25
0
Issues implementing jquery-form plugin for displaying image via an ajax call in my rails poc
...1 (line 57)
[Break on this error] dataType: ''script''
group....6319739 (line 43)
$(this).ajaxSubmit is not a function
[Break on this error] dataType: ''script''
My group.js file in public/javascripts is like this:-
jQuery.ajaxSetup({
''beforeSend'' : function(xhr) {
xhr.setRequestHeader("Accept","text/javascript")
}
})
$(''#post_msg input'').val('''');
$(document).ready(function() {
$(''#uploadForm'').bind(''submit'', function(...