I'm trying to set up an app in google app engine to do a similar thing to the application demonstrated in this google io talk. this is my html code which is basically entirely lifted from the talk-
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script language="JavaScript">
function startUpload(f){
if(typeof jQuery != 'undefined') { document.writeln("jQuery!"); } else { document.writeln("no jQuery :("); }
document.write("topwrite");
$.ajax({url:'http://projectid.appspot.com/getFileUploadEndpoint', cache: false, success: function (data){
document.write("i can write");
var fd = new FormData();
for(var n in data.params){ fd.append(n, data.params[n]); }
fd.append('file', f);
var xhr = new XMLHttpRequest();
xhr.upload.addEventListener('progress', function (evt){ $('#progress').text(evt.loaded+'/'+evt.total);}, false);
xhr.upload.addEventListener('load', function (evt){ $('#progress').text('Complete'); }, false);
xhr.open(data.method, data.url);
xhr.send(fd);
},
error: function(errorThrown){ document.write("didn't work did it"); document.write(errorThrown); } });
return true;
}
</script>
</head>
<body>
<form id="uploadbanner" enctype="multipart/form-data" onsubmit="return startUpload(myfile)">
<input id="fileupload" name="myfile" type="file" />
<input type="submit" value="submit" id="submit" />
</form>
</body>
</html>
i know the /getFileUploadEndpoint works fine because i can go to that url and see the endpoint info print out and change every time i refresh but nothing inside either the success function or the error seems to run (that is to say i see "jQuery!topwrite" printed between pages but nothing else and the upload obviously isn't working) can anyone tell me what i'm doing wrong?