The following code work fine in regular View but not in partial view
<script>
$.noConflict();
var uniqueId = '@Guid.NewGuid().ToString()';
jQuery(document).ready(function ($) {
console.log(uniqueId);
$("#Myform input[name='clientId']").val(uniqueId);
console.log($("#Myform input[name='clientId']").val());
var bar = $('.progress-bar');
var percent = $('.percent');
var status = $('#status');
$('#Myform').ajaxForm({
beforeSend: function () {
status.empty();
var percentVal = '0%';
bar.width(percentVal);
percent.html(percentVal);
$("#pleaseWaitDialog").modal({ backdrop: 'static', keyboard: false });
$('#statusBorder').show();
//$("#pleaseWaitDialog").modal({ backdrop: 'static', keyboard: false });
},
uploadProgress: function (event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
bar.width(percentVal);
percent.html(percentVal);
},
complete: function (xhr) {
getStatus();
status.html(xhr.responseText);
//$("#pleaseWaitDialog").modal('hide');
}
});
});
</script>
I've got a error "$(...).ajaxform is not a function"
Here what i already tried:
Partial view isn't loaded when the page loads.
You must force that the function called after the partial view loaded.
You are doing it:
the most elegant ways is the first two option.