2

While submitting the data : Error Message : XMLHttpRequest cannot load https://docs.google.com/forms/d/xxxxxxxxxxxxx/formResponse. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8090' is therefore not allowed access. The response had HTTP status code 405.

    $scope.postDataToGoogle = function(){
    $http({
        method: 'POST',
        crossDomain: true,
        url: 'https://docs.google.com/forms/d/XXXXXXXXXXXXXXXXXXXXXXXX/formResponse',
        // dataType: "xml",
        data: tempData,
        }).success(function(data,status){
            //alert(data)
            console.log("Success");

        }).error(function(data,status) {
            console.log('Error:' + status);
        });

    }
2
  • Hello this issue may be related to this question. It sounds like google docs doesnt support CORS requests, but the OP posted a work around. Commented Apr 18, 2016 at 12:31
  • 1
    Google does not support. this link might useful stackoverflow.com/questions/18172801/… Commented Sep 25, 2016 at 7:03

2 Answers 2

1

Its not about jquery or angular, CORS allows or disallow done by Back-end server. Google might not support this.(to access https://docs.google.com)

CORS (Cross-Domain Resource Sharing) allows you to more cleanly separate your front-end from your back-end.

CORS is a group of special response headers sent from the server that tell a browser whether or not to allow the request to go through

Access-Control-Allow-Origin: http://example.com.

Why does jQuery throw an error when I request external resources using an Appcache Manifest?

Sign up to request clarification or add additional context in comments.

Comments

1

I do have tried with angular still not able solve it, but with jQuery its works for me.

$.ajax({
            url: 'https://docs.google.com/forms/d/xxxxxxxxx',
            data: tempData,
            type: "POST",
            dataType: "xml",
            statusCode: {
                0: function () {
                    alert('error');

                },
                200: function () {
                    alert('Thank you for your valuable feedback');

                }
            }
        })

1 Comment

can I send data type as json insted of xml.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.