Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

everyeurocounts on "jQuery .post save to database"

$
0
0

Hi,

I have the following code to pass a post_date to a php file to save it after a user selects a date. The problem is the event is not firing...i hard coded the values into the phpfile to check..Anyone any ideas?

jQuery

<script type="text/javascript">
			var array = ["<?php
echo $comma_seperated;
?>"];

				jQuery(document).ready(function() {
				jQuery('#MyDate').datepicker({
				beforeShowDay: function(date){
				var string = jQuery.datepicker.formatDate('yy/mm/dd', date);
				return [ array.indexOf(string) == -1 ]
				},
				})

				var bf = jQuery('#stotal').val();
				var vf = parseInt(bf)*.21;

				jQuery('#vat').val(vf);

				vtf = (parseFloat(vf)+parseFloat(bf)).toFixed(2);

				jQuery('#Total').val(vtf);
			});

				jQuery('#MyDate').change(function() {
					$.post(
					"http://xxxxxxx.com/www/wp-content/themes/gbs-prime-child-theme-merchant-dashboard/datesave.php",
					{
						MyDate: jQuery('#MyDate').val()

					}
					)});

			</script>

datesave.php

<?php
$posted_id = "408";
//(isset($_POST['$posted_id'])) ? htmlspecialchars($_POST['posted_id') : 0;
$temp_submitted_post_time = "12/13/2013"; 

//(isset($_POST['MyDate'])) ? strtotime($_POST['MyDate']) : 0;

$args = array(
    'ID' => $posted_id,
    'post_status' => 'temp',
    "edit_date" => true,
    'post_date' => date('Y-m-d H:i:s', $temp_submitted_post_time),
    'post_date_gmt' => gmdate('Y-m-d H:i:s', $temp_submitted_post_time)
);
wp_update_post($args);

?>

Viewing all articles
Browse latest Browse all 8245

Trending Articles