jquery - Ajax request is not working -


i trying data db using ajax. when date selected inline calender date captured , query done , ive show holiday status of selected date. ajax request not working, how know whether working or not.

my code is

$(function () {     $("#divcalendar").datepicker({         dateformat: "mm-dd-yy",         onselect: function (selecteddate) {             //alert("you clicked on " + selecteddate.tostring());             var datastring = 'sdt='+ selecteddate.tostring();             //alert("you clicked on " + datastring);             $.ajax({                 type: "post",                 url:"demotest.php",                 data: datastring,                 datatype : "json",                 success:function(data){                     if(data != "error")                       {                         $("#div1").html(data);                     }                     else                     {                         $("#div1").html("nothing found");                         }                 }             });         }     }); });     

in $.ajax, datatype parameter refers type of data you're expecting server ajax response. setting in call json.

but line

$("#div1").html(data); 

seems expecting normal text or html response. if response not valid json ajax call not work. else remove datatype : "json", line , let ajax utility default text response.

you can hints regarding error encountered in ajax call checking browser console (chrome inspector/firebug).


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -