javascript - jQuery post data showing in console.log but triggering 'Uncaught TypeError: object is not a function' with alert() -
i'm stuck here. i'm trying do ajax post add event fullcalendar (which might irrelevant). i'm returning integer php json_encode , trying check value in post success function. value shows correctly in console when try alert it gives error: uncaught typeerror: object not function
here's code:
$('[data-form=shtotakim]').submit(function(e){ e.preventdefault(); $.fn.spin.presets.ss = { lines: 9, // number of lines draw length: 5, // length of each line width: 2, // line thickness radius: 3, // radius of inner circle corners: 1, // corner roundness (0..1) rotate: 0, // rotation offset direction: 1, // 1: clockwise, -1: counterclockwise color: '#fff', // #rgb or #rrggbb or array of colors speed: 1.3, // rounds per second trail: 53, // afterglow percentage shadow: false, // whether render shadow hwaccel: false, // whether use hardware acceleration classname: 'spinner', // css class assign spinner zindex: 2e9, // z-index (defaults 2000000000) top: 'auto', // top position relative parent in px left: '34px' // left position relative parent in px }; var = $(this).find('button'); but.text('').prop('disabled', true).attr('style', 'height: 30px;'); $('[data-type=spinner]').spin('ss'); var url = $(this).attr('action'); var data = $(this).serialize() + '&date=' + $('[data-type=date]').html(); // var title = "title"; $.post(url, data, function(data){ $('[data-type=spinner]').spin(false); but.text('aggiungi').prop('disabled', false).removeattr('style'); // checking part console.log(data); alert(data); if(data == 4) { alert('hello world'); } $('#calendar').fullcalendar('refetchevents'); ev = new object(); }, 'json'); });
Comments
Post a Comment