Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am unable to set the contentType on an ajax request #383

Open
chinshaw opened this issue Feb 16, 2017 · 0 comments
Open

I am unable to set the contentType on an ajax request #383

chinshaw opened this issue Feb 16, 2017 · 0 comments

Comments

@chinshaw
Copy link

chinshaw commented Feb 16, 2017

I am trying to submit a form upload using the Ajax request but it appears that the contentType is being overridden with the resolveSettings() method of the Ajax class. In my example below when I observe the request to the server it is setting the content type to urlencoded instead of using my choice of multipart/form-data.

form.bind("submit", null, new Function() {
            public boolean f(Event e) {
                Ajax.ajax(Ajax.createSettings().setType("post").setContentType("multipart/form-data")
                        .setUrl(form.attr("url")).setData(form).setSuccess(new Function() {
                            public void f() {
                                Window.alert("SUCCESS");
                            }
                        }));
                e.preventDefault();
                return true;
            }
        });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant