Comments (4)
Hey Todd, I think the problem is that your page is using XHTML transitional, and Rails 3 and jQuery UJS are dependent upon HTML 5. You can see my article for the full scoop explaining the role that HTML 5 plays in remote links/forms in Rails 3.
Try using the HTML 5 declaration at the top of your layout, by replacing this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
With this:
<html>
from remotipart.
Hey Todd, I think I figured it out. The request actually is being sent to your server, but the server is returning a 404 Nginx error, which means the request isn't making it to your rails app, which explains why it's not showing up in your app's log. If you look in the "Net" tab of Firebug, you can see the request being sent and the Nginx 404 response being received.
Because of the way IE treats requests for JS data-types from the iframe that's generated by remotipart.js, remotipart has to append the '.js' extension to the request URL so that the server knows it's a JS request.
Anyway, it seems your Nginx server is not configured to accept requests for http://tuys.seebuzz.com/entries.js (or perhaps it's checking for entries.js in the public folder and not finding it), so it is returning a 404. This is why posts without file uploads work in your form; in that case, it's submitting a POST request to /entries. Meanwhile, file uploads fail; they must submit via a hidden iframe to /entries.js, which should be going to your 'entries' action with a JS format request type.
I'd say there are two solutions. a) Fix the Nginx conf to allow for /entries.js to route to your rails app as normal, or b) change the 'data-type' of your remote form to something other than JS, maybe HTML or JSON.
from remotipart.
Steve,
It works now. Woot!
See the nginx.conf entry for this dev server and the portion I commented out
to get remotipart working:
server {
listen 80;
server_name someserver.com;
root /home/username/someserver.com/railsapp/public;
# serve static content directly
#location ~* \.(ico|jpg|gif|png|css|js|swf|html)$ {
#if (-f $request_filename) {
#expires max;
#break;
#}
#}
passenger_enabled on;
}
Much thanks for your help!
Todd
On Sat, Mar 26, 2011 at 10:53 AM, JangoSteve <
[email protected]>wrote:
Hey Todd, I think I figured it out. The request actually is being sent to
your server, but the server is returning a 404 Nginx error, which means the
request isn't making it to your rails app, which explains why it's not
showing up in your app's log. If you look in the "Net" tab of Firebug, you
can see the request being sent and the Nginx 404 response being received.Because of the way IE treats requests for JS data-types from the iframe
that's generated by remotipart.js, remotipart has to append the '.js'
extension to the request URL so that the server knows it's a JS request.Anyway, it seems your Nginx server is not configured to accept requests for
http://tuys.seebuzz.com/entries.js (or perhaps it's checking for
entries.js in the public folder and not finding it), so it is returning a
404. This is why posts without file uploads work in your form; in that case,
it's submitting a POST request to /entries. Meanwhile, file uploads fail;
they must submit via a hidden iframe to /entries.js, which should be going
to your 'entries' action with a JS format request type.I'd say there are two solutions. a) Fix the Nginx conf to allow for
/entries.js to route to your rails app as normal, or b) change the
'data-type' of your remote form to something other than JS, maybe HTML or
JSON.Reply to this email directly or view it on GitHub:
https://github.com/formasfunction/remotipart/issues/16#comment_920756
from remotipart.
Awesome, glad it worked out. You probably still want Nginx to server static files directly for the most part, so your ruby instances aren't spinning up for every static file request. Perhaps instead of commenting all that out, you could just remove the ".js" extension from the list of static file-type matches. So change this:
location ~* \.(ico|jpg|gif|png|css|js|swf|html)$ {
To this:
location ~* \.(ico|jpg|gif|png|css|swf|html)$ {
from remotipart.
Related Issues (20)
- How can I install the latest version of the gem? HOT 3
- work with devise HOT 3
- Double Submit HOT 12
- Does Remotipart need all 24kb jQuery Form Plugin? HOT 3
- $.rails is undefined HOT 10
- Form Post Format when submit button is disabled HOT 2
- Multiple uploaded files on same form HOT 7
- Other forms of response HOT 1
- Don't truncate response if it includes </textarea> HOT 2
- Not working on Chrome v17.0.963.46 HOT 5
- Does not send X-CSRF-Token header
- rails 3.2.3 HOT 1
- Remotipart X-CSRF-Token HOT 1
- Script5: Access denied when trying to submit form in IE9 + gmail HOT 3
- Double post HOT 1
- Issue with jquery-rails 2.1.0 HOT 1
- Doesn't work when forms have fields added after page load HOT 1
- Documentation out of date? HOT 2
- Remotipart Posts twice
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from remotipart.