First AJAX makes a post to upload file now I just want this same AJAX when submitted to grab the data from second AJAX and post it together basically I want to post the Id back to the database, everything works just do not know how to combine the data together.
Code
<script type="text/javascript">
$(document).ready(function () {
$('#submit').click(function () {
var data = new FormData();
var files = $('#fileupload').get(0).files;
if (files.length > 0) {
data.append("UploadedFile", files[0]);
}
$.ajax({
type: "POST",
url: "ControllerHandler.ashx",
contentType: false,
processData: false,
data: data
});
});
$.ajax({
url: 'SelectType.ashx',
method: 'Post',
dataType: 'json', //make sure your service is actually returning json here
contentType: 'application/json',
data: '{}',
success: function (data, status) {
$.each(data, function (i, d) {
$('#seasontype_select2').append('<option value="' + d.value + '">' + d.label + '</option>');
});
}
});
});
</script>
Ajax requests can be nested.