jquery - Fullcalendar not posting valid JSON -
i can't figure out what's wrong code, have dependencies loaded jquery 1.9.1 jquery ui 1.10.2, fullcalendar.min.js , following example it's shown.
here ajax call:
$(document).ready(function() { $('#calendar').fullcalendar({ events: { type: 'post', url: 'mypage.cfc', data: json.stringify({ param_one: "test", param_two: "testing"}), contenttype: "application/json; charset=utf-8", datatype: "json", error: function() { //alert('there error while fetching events!'); }, color: 'yellow', // non-ajax option textcolor: 'black' // non-ajax option } }); }); on coldfusion end page, expecting json, kept getting json parsing failure, checked firebug see being sent in post , it's not sending valid json data. here firebug shows in post:
0=%7b&1=%22&2=p&3=a&4=r&5=a&6=m&7=_&8=o&9=n&10=e&11=%22&12=%3a&13=%22&14=t&15=e&16=s&17=t&18=%22&19=%2c&20=%22&21=p&22=a&23=r&24=a&25=m&26=_&27=t&28=w&29=o&30=%22&31=%3a&32=%22&33=t&34=e&35=s&36=t&37=i&38=n&39=g&40=%22&41=%7d&start=1361685600&end=1365310800 i've tried trimming code down, see if can narrow problem down, tired:
$(document).ready(function() { $('#calendar').fullcalendar({ events: 'mypage.cfc' }); }); and in case nothing get's posted @ all. see in params tab this:
_ 1364228830548 end 1365310800 format json start 1361685600 what missing here? ideas?
solution:
ok hope helps else struggling this. ganeshk pointing me in right direction. documentation fullcalendar sparse, thought jquery code supposed send json data, doesn't. sends string.
on coldfusion side if want capture string can use this:
<!--- query string ---> <cfset urlstring = gethttprequestdata().content > <!--- local structure ---> <cfset cfdata = structnew()> <!--- loop our query string values , set them in our structure ---> <cfloop list="#urlstring#" index="key" delimiters="&"> <cfset cfdata["#listfirst(key,'=')#"] = urldecode(listlast(key,"="))> </cfloop> then in code in sql statment can use #cfdata["start"]# or other params pass.
once have query, can populate array , send , populate calendar.
Comments
Post a Comment