I need to create an upload button that when reading the xml of my invoice can display the NFe key that is inside the tag, inside an input.
I have already used several methods and are not deseralizing.
public void UploadXML(string CHAVE_ACESSO_NFE)
{
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load("");
var chave = xmldoc.SelectSingleNode("cNF").Value;
if (chave != null)
{
chave = CHAVE_ACESSO_NFE;
}
else
{
chave = "";
}
}
<div class="col-md-12">
<div class="col-md-5">
<div class="flow-btn">
<label class="control-label">Enviar XML</label>
<input id="UploadXML" name="UploadXML" data-val="" type="file" value="">
</div>
</div>
</div>
$(function () {
survey("#UploadXML", function () {
var upload = $("#UploadXML").val();
var chave = getElementByTagName("<cNF>").val();
if (upload.length != 'undefined') {
$.ajax({
url: '@Url.Action("UploadXML", "SolicitacaoOC")',
type: 'GET',
dataType: 'json',
data: {
CHAVE_ACESSO_NFE: chave
}
}).done(function (data) {
if (upload != null) {
chave = upload.val();
} else {
chave = "";
}
});
}
})
});