6
I have this code to put mask on the field:
(function ($) {
$(function () {
$("#txtCnpjPesquisa").mask("99.999.999/9999-99");
});
})(jQuery);
Now here I must pass the field cnpj($("#txtCnpjPesquisa").val())
without the mask. How do I do it?
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 on that line:
data: JSON.stringify({ pesquisaCnpj: resultado }),
Uncaught Typeerror: Converting circular Structure to JSON
Could you tell which library you are using?
– Wakim
@pnet, it seems to me that you are using a plugin, it is important to mention that
– CesarMiguel
@pnet, what is the result of
alert(resultado);
??– CesarMiguel