Format or pass string from PHP (javascript) to jquery timepicker -
i sending datetext first php , mysql. upon response sql server, want echo string javascript (jquery).
so far works, cannot pass string callback $.post disabledtime without removing ''
beginning , end of string. else works perfect. ideas?
onselect: function(datetext, inst) { var selected = datetext; $.post('plik.php?mdate='+selected, function(queryresult){ var disabledtime = queryresult; $('#timepicker').timepicker('option', 'disabletimeranges', disabledtime); });
in plik.php, can pass data json, makes easy use in jquery. don't know actual value is, used placeholder "the value of disabled time".
echo json_encode( array( 'disabledtime' => 'the value of disabled time' ));
then in js, use json. converted jquery request, based on showing in code:
onselect: function(datetext, inst) { var selected = datetext; $.get('plik.php', {'mdate':selected}, function(data){ $('#timepicker').timepicker('option', 'disabletimeranges', data.disabledtime); }, 'json'); }
wiki
Comments
Post a Comment