I'm backend developer and pretty new in Javascript. I'm trying to upload files with old JQuery version (1.4.2), because there is no way to change it on current project.
This code works good on ANY JQuery version >= 1.5
$('#uploadform').submit(function(e) {
var formData = new FormData(this);
$.ajax({
type:'POST',
url: '/uploader',
data:formData,
xhr: function() {
var myXhr = $.ajaxSettings.xhr();
if(myXhr.upload){
//
}
return myXhr;
},
cache:false,
contentType: false,
processData: false,
success: function(data){
//
},
error: function(data){
//
}
});
});
Each time a run it on JQuery 1.4.2, I have this error in Chrome (and other browsers):
POST http://localhost:8080/uploader net::ERR_CONNECTION_RESET
in jquery-1.4.2.js:5252
Is there a way to fix it without JQuery version change?
UPD
Here is my <head>
section in html
<head>
<meta charset="UTF-8">
<title>Remedy Uploader</title>
<link type="text/css" rel="stylesheet" href="style.css" media="screen"/>
<script type='text/javascript' src="https://code.jquery.com/jquery-1.4.2.js"></script>
<script type='text/javascript' src="script.js"></script>