I would like to get help with using ajax without jQuery to post data info a Google spreadsheet please.
As in jQuery it is really simple and goes like this:
var gformUrl = 'https://docs.google.com/forms/d/abcdefg1234567890/formResponse';
var gformData = {
'entry.1405357202': 'text #1',
'entry.2112718259': 'text #2',
'entry.1657451952': 'text #3',
'entry.737451165': 'text #4'
};
$.post(gformUrl,gformData);
Now even that it shows an error in the console for no cross origin, it still works great.
I'm trying to do not use jQuery and do that in pure javascript, but with no success just yet, here's my code:
var xhr = new XMLHttpRequest();
xhr.open('POST', gformUrl, true);
xhr.send(JSON.stringify(gformData));
$.post()method still works by adding those entries in your spreadsheet?XMLHttpRequest cannot load https://docs.google.com/forms/d/abcdefg1234567890/formResponse. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.