I'm running a script that was passed to me by third parties. And it is giving the following error:
TypeError: $ .toJSON is not a function
QtdeQuartos: $.toJSON(qtdQuartos),
I'm running a script that was passed to me by third parties. And it is giving the following error:
TypeError: $ .toJSON is not a function
QtdeQuartos: $.toJSON(qtdQuartos),
The script probably makes use of the jquery-json library. Download it and add it to your project.
toJSON
(English) is a method the JavaScript itself is called from your object.
var d = new Date();
var today = d.toJSON();
//Resultado: 2014-02-21T21:57:42.080Z
Receiving this via jQuery, you should use the parseJSON
method :
var obj = jQuery.parseJSON( '{ "name": "John" }' );
alert( obj.name === "John" );