scripting a google docs form submission

前端 未结 7 1658
时光说笑
时光说笑 2020-12-04 15:46

I\'m trying to create a bookmarklet that parses a page and sends the results to a googledocs spreadsheet via a form that I\'ve defined.

The relevent bit of the scrip

7条回答
  •  忘掉有多难
    2020-12-04 16:27

    I don't have a complete answer, but I have been able to make it work using Curl:

    curl http://spreadsheets.google.com/formResponse?formkey=dFpVLTVFY2t5dWdoNTZpNERwWDRxX2c6MQ&ifq --data entry.0.single=eric --data entry.1.single=pugh
    

    Also, I am able to have it work via Ajax using prototype, but ONLY on Safari.

    I too get the same 405 Method not allowed in Firefox. Here is my script:

    function vote_for_synonym(word1, word2){
    word1 = encodeURIComponent(word1);
    word2 = encodeURIComponent(word2);
    
    $req = new Ajax.Request("http://spreadsheets.google.com/formResponse?formkey=dFpVLTVFY2t5dWdoNTZpNERwWDRxX2c6MQ", {
      method: 'post',
      contentType: 'application/x-www-form-urlencoded',
      onCreate: function(){
       Element.show('systemWorking');
      },
      onSuccess: function() {
        Element.show('thanks');
        Element.hide('systemWorking')
      },
      onFailure: function() {
        Element.show('error');
      }
    });           
    

    }

    Also, my onFailure never gets called, just onSuccess.

提交回复
热议问题