Subversion Repositories SmartDukaan

Rev

Rev 23347 | Rev 23379 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23347 Rev 23377
Line 102... Line 102...
102
	});
102
	});
103
}
103
}
104
 
104
 
105
function uploadDocument(file){
105
function uploadDocument(file){
106
	var url = '/profitmandi-web/document-upload';
106
	var url = '/profitmandi-web/document-upload';
107
	var response = doAjaxUploadRequest(url, 'POST', file);
107
	doAjaxUploadRequestHandler(url, 'POST', file, function(response){
108
	var documentId = response.response.document_id; 
108
		var documentId = response.response.document_id; 
109
	console.log("documentId : "+documentId);
109
		console.log("documentId : "+documentId);
110
	return documentId;
110
		return documentId;
-
 
111
	});
111
}
112
}
112
 
113
 
113
function doAjaxGetDownload(urlString, httpType, fileName){
114
function doAjaxGetDownload(urlString, fileName){
-
 
115
	console.log("fileName : "+fileName);
114
	doAjaxDownload(urlString, "GET", null, fileName);
116
	doAjaxDownload(urlString, "GET", null, fileName);
115
}
117
}
116
 
118
 
117
function doAjaxPostDownload(urlString, httpType, data, fileName){
119
function doAjaxPostDownload(urlString, data, fileName){
118
	doAjaxDownload(urlString, "POST", data, fileName);
120
	doAjaxDownload(urlString, "POST", data, fileName);
119
}
121
}
120
 
122
 
121
function doAjaxDownload(urlString, httpType, data, fileName){
123
function doAjaxDownload(urlString, httpType, data, fileName){
122
	xhttp = new XMLHttpRequest();
124
	xhttp = new XMLHttpRequest();
Line 131... Line 133...
131
	        a.style.display = 'none';
133
	        a.style.display = 'none';
132
	        document.body.appendChild(a);
134
	        document.body.appendChild(a);
133
	        a.click();
135
	        a.click();
134
	    }
136
	    }
135
	    if(xhttp.readyState == 4 && xhttp.status === 400){
137
	    if(xhttp.readyState == 4 && xhttp.status === 400){
136
	    	badRequestAlert(xhttp.responseText);
138
	    		badRequestAlert(xhttp.responseText);
137
	    }
139
	    }
138
	    if(xhttp.readyState == 4 && xhttp.status === 500){
140
	    if(xhttp.readyState == 4 && xhttp.status === 500){
139
	    	internalServerErrorAlert(xhttp.responseText);
141
	    		internalServerErrorAlert(xhttp.responseText);
140
	    }
142
	    }
141
	};
143
	};
142
	// Post data to URL which handles post request
144
	// Post data to URL which handles post request
143
	xhttp.open(httpType, urlString);
145
	xhttp.open(httpType, urlString);
144
	if(httpType == "POST"){
146
	if(httpType == "POST"){