I have been trying for the last 2 hours to pass parameters from my jquery to PHP. I can not understand this. Therefore my code goes for
var something = getUrlParameter('month'); function Refresh() { $.ajax({ type: 'POST', url: 'getCalendar.php', data: {test:something}, success: function(data){ if(data != null) $("#calendarDiv").html(data) } }); }
getUrlParameter
function getUrlParameter(sParam) { var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split('='); if (sParameterName[0] == sParam) { return sParameterName[1]; } } }
I just can't transfer anything to the php file. Thank you My goal is to convey? Month = something & year = something in a PHP file, so I can rely on this display calendar.
Example URL: http://chanceity.com/calendartest.html
But this does not work, because my php file does not receive these parameters.
source share