I have this code to put mask in the field:
(function ($) {
$(function () {
$("#txtCnpjPesquisa").mask("99.999.999/9999-99");
});
})(jQuery);
Now here I need to pass the cnpj($("#txtCnpjPesquisa").val())
field without the mask. How do I do this?
function MontaPesquisa() {
if ($("#txtCnpjPesquisa").val() != "")
resultado = ({ "cnpj": $("#txtCnpjPesquisa").val() });
else
return;
alert(resultado);
$.ajax({
url: '/Pesquisa/MontaTelaPesquisa',
datatype: 'json',
contentType: "application/json; charset=utf-8",
type: "POST",
data: JSON.stringify({ pesquisaCnpj: resultado }),
success: function (data) {
str += '<label>CNPJ digitado incorretamente!</label>';
$('#filtroPesquisa').html(str);
},
error: function (error) {
}
});
}
Here is the error in Json:
$.ajax({
url: '/Pesquisa/MontaTelaPesquisa',
datatype: 'json',
contentType: "application/json; charset=utf-8",
type: "POST",
data: JSON.stringify({ pesquisaCnpj: resultado }),
success: function (data) {
Specifically in this line:
data: JSON.stringify({ pesquisaCnpj: resultado }),
Uncaught TypeError: Converting circular structure to JSON