Displaying 20 results from an estimated 40000 matches similar to: "application/json request defaults?"
2007 Jun 04
2
Re: Ajax.Request question with JSON return
Do I need something like this:
eval(''('' + this.header(''X-JSON'') + '')'')
(taken from Cody Swann,
http://ajaxian.com/archives/prototype-extension-dynamic-script-pattern-support
).
I''m guessing my problem is simpler, and I''m leaving something small out
related to the header though.
Thanks for any help
-Mark
1. evalJSON:
2010 Jun 24
0
Rails3: render_to_string of a .html.erb when request is a json request raises MissingTemplate error
I''ve the following situation (which actually works in Rails 2.3.8 and
this is a result of the migration of our app to rails3):
I have a partial which is rendered a few times (imagine tr''s in a
table). On the clientside there''s a script that does a json request
for a specific row (jQuery + ajax dataType: ''json'' and type: ''POST'')
In
2012 Nov 30
1
q@ request.request_method=='OPTIONS', ajax, post json
hi
im reading through the topic above and trying to apply it to my app.
as reference i found:http://leopard.in.ua/2012/07/08/using-cors-with-rails/
my prob is that i dont see the ''preflight'', meaning the first request
prior the actual post, which should(?) deliver this:
request.request_method==''OPTIONS''
the js code look like this:
$.ajax
({
type:
2008 Sep 08
0
Best way to send JSON request/get a response from controller?
Hello Friends,
What is the best way to send json from your controller, and await for a
response? Ajax? Ruby''s net/http?
The JSON server that I am sending the request to only accept POST methods,
and sends a POST back. If I use Ajax, is it possible to get the POST
response? Is there a scriptaculous or YUI function that handles this well?
Thank you for your help -
Jin
2009 Apr 08
0
authenticity problem with jrails ajax
I''m using jrails and I found when I use the authenticity_token in
certain javascript calls, that the
url works differently in that the paramters in the :with clause get
dropped if they are in a json type syntax.
Below is an example of a remote_function() call from JS that used to
work fine without authenticity.
When I enabled authenticity it adds the authenticity token
automatically, but
2013 Jan 16
0
Rails 3.2 jQuery JSONP request not working - Moved Permanently
I am trying to send a POST request ( ''remove_tag_named'' )and getting a
simple OK back on success ; it doesn''t work..
the post is correctly sent , but after then it''s looping on sending a GET
request to the same url, with the error
301 Moved Permanently
I should not be far fro the solution, but I am stuck :
In my routes.rb
*namespace
2012 Mar 26
3
render :json not sending any data back ...
[rails 3.2.2]
I perform an ajax call :
...
$.ajax
url: " /backoffice/expenses/rate"
type: "GET"
dataType: "json"
data:
project_id: $(''#project_id'').val()
code: $(this).val()
success: (result) ->
alert result
$(''#expense_price'').val(result)
in
2008 Aug 10
1
Prototype, JSON and headers
Hi everyone.
I love JSON and using Prototype has help me reduce the code to handle
AJAX responses.
But one thing keeps me confused and sometimes even frustrated.
I don''t really understand what is going on with the headers, so if
someone could take some time to explain what is going on, I (and
probably a lot more people) would be very thankful.
The thing is this. On my local server (Mac OS
2009 Jul 05
2
JSON data not decoded in Rails
Hello all,
I''m trying to send some json data from the browser to the server using
prototype without success. On the server side ActiveSupport::JSON.decode
isn''t decoding the data.
Here is the code:
Javacript:
<a href="#" onclick=''send();return false;''>click</a>
<script>
function send() {
var send_data_url =
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
2009 Nov 01
0
Ajax calls in application.js (authenticity_token problem?)
Hi,
I have a long list (~50) of items which should each be clickable and
will send an Ajax request to the server. Now, each item will be calling
the same action, just with a different id.
Ideally this looks like a clear case of putting the Ajax javascript in
application.js. It''s in one place, just call a single function onclick
and pass through the id.
However there are 2 issues:
1. I
2008 Feb 05
0
prototype-1.6.0.2 Newbie Why is AJAX.request fired 3 times?
Hello list!
I am taking my first steps with AJAX and decided to give prototype a
try.
- I add a reference to the script to my page
- Then somewhere near the bottom of the page I fire up:
new Ajax.Request(''ws_adrestype.php'', {
method:''get'',
requestHeaders: {Accept: ''application/json''},
onSuccess:
2006 Dec 06
0
Respond to and render JSON in [5694]
Hey, this is great to see this in trunk. It answers some questions I''ve
been having about what is the best way to use JSON on the client side; it
seems like the :callback approach is becoming the standard.
A related question -- Prototype has this support for an "X-JSON" header that
allows pure JSON to be sent in a response header and it gets evalled and
passed to ajax
2008 Feb 10
3
Ajax.Request evalJSON document.write hangs
I''m not the best when it comes to javascript so this is probably a
simple mistake. I''m using the following code to read an external json
file and print out its values. The problem is when I try to write the
value to the browser it causes the browser to load like it hasn''t
finished the javascript code. Its writing the value to the screen so I
think its hanging after that
2006 Jun 14
2
Global variables and onComplete in Ajax.Request
Hello everyone,
Just a note, I have to pass my JSON in the response body. I''m aware
of the X-JSON header, but am passing too much data to use it. No
problem and I have code that has it working well.
While I''m getting my JSON data back and can do whatever I''d like with
it in "setMakeVars", I''d like to set it to a global var "gljson"
below,
2007 Jul 08
2
problems using ajax call inside a json object.
Hi all im new at this list, i have a problem when i make an ajax call
inside a json object.
Whe i test using IE works but when i use firefox nothing happend.
you can see the problem at:
http://mandela.no-ip.info/prototypeproblem/index.html
I appreciate any kind of help / suggestion
thanx in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are
2005 Sep 21
2
Result Documents XML or JSON?
My Java servlets can generate both JavaScript objects, like
JSON, and XML. I can generate both pretty easily.
What''s best practice for AJAX responses? Return scripts to be
evaled by the Ajax control, or return XML documents and iterate
them using XML DOM?
Thanks.
--
Alan Gutierrez - alan@engrm.com
- http://engrm.com/blogometer/index.html
-
2007 Aug 26
0
How can I return a json packet?
I used extjs and ror,this is the part of my ror code:
def create
@enterprise = Enterprise.new(@params[:enterprise])
p @enterprise
if @enterprise.save
flash[:note] = ''Enterprise unit was successfully created.''
p "michael"
redirect_to(:action=>index)
else
p "error"
render_action ''new''
2010 Sep 04
0
CSRF protection not working with jquery ajax post request
Hallo,
I want to test the csrf protection of my application but forgery
protection is not working with jquery ajax request.
I have used Unobtrusive Javascript with jquery
I have removed the
<%= csrf_meta_tag %>
so that my application do not include authenticity token.
In my view I have the following code
$(function () {
$(''#alert'').click(function () {
$.ajax({
2006 May 24
5
best way to return JSON?
I''m using Ajax.Updater to update a select element, and have just discovered
that IE doesn''t like having its innerHTML set. I figure instead of a bunch
of option tags I can return JSON and parse it to add the options, but I''m
not quite sure of the best way to do this.... or any way to do it really :)
Could someone point this out to me? Or am I using a totally antiquated