GithubHelp home page GithubHelp logo

Comments (7)

tracker1 avatar tracker1 commented on May 5, 2024

try this...

  ...
  ,data: JSON.stringify(config)
  ,contentType: 'application/json'
  ...

from jquery-ajaxtransport-xdomainrequest.

hzxie avatar hzxie commented on May 5, 2024

Still not working.

The URL of web page is http://127.0.0.1:8085/?module=goagent&menu=config.
The Ajax is code is:

$.ajax({
    url: 'http://127.0.0.1:8084/config?cmd=set_config',
    data: config,
    contentType: 'application/json',
    type: 'POST',
    dataType: 'JSON'
}).done(function(result) {
    console.log(result);
});

The Chrome returns the error message that XMLHttpRequest cannot load http://127.0.0.1:8084/config?cmd=set_config. Request header field Content-Type is not allowed by Access-Control-Allow-Headers..

from jquery-ajaxtransport-xdomainrequest.

MoonScript avatar MoonScript commented on May 5, 2024

@zjhzxhz sounds like you have to remove the contentType option (since the XDR option does not set it).

from jquery-ajaxtransport-xdomainrequest.

tracker1 avatar tracker1 commented on May 5, 2024

@zjhzxhz Do you have CORS setup properly on the destination host?

from jquery-ajaxtransport-xdomainrequest.

JokerQyou avatar JokerQyou commented on May 5, 2024

I'm having the same issue, I have CORS setup properly on the destination host, I know this because I can directly use $.ajax() to access it in Chrome when I'm not using your plugin. And now I want to add support for IE 8, and things become mysterious. Nothing is wrong with the scripts, but the server on the destination host receives 0 length request with no post data. And by manually executing $.ajax() in developer tool, an error tell me that there is a 500 server error, yet my server receives no request.

from jquery-ajaxtransport-xdomainrequest.

MoonScript avatar MoonScript commented on May 5, 2024

When posting, the IE XDR object will only send the data as text/plain, so your server has to be prepared to handle that.

from jquery-ajaxtransport-xdomainrequest.

JokerQyou avatar JokerQyou commented on May 5, 2024

Exactly. I've managed to solve this on my server side few momths ago. For Python flask server, the data is in request.data, and for Python pyramid server, the data is in request.text. All of which are not the usual way of getting parameters or POST data.

from jquery-ajaxtransport-xdomainrequest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.