0

I want to send data to a page using .post(), but the date is not sent, I

puzzle = JSON.stringify(puzzle);
        var today = new Date();
        $.post("script/add_grid.php",
        {Puzzle:puzzle, designer:$("#designer").val(), name: "تجربة 1", creation_date:today});

add_grid.php

$db_word->insert_grid($_REQUEST['Puzzle'],$designer,$name,$creation_date);

I am receiving this error message:

<b>Notice</b>:  Undefined index: creation_date in <b>D:\xampp\htdocs\entertainment\script\add_grid.php</b> on line <b>6</b><br />

what might be the solution?

mfadel
  • 887
  • 12
  • 32

1 Answers1

1

I would assume you are after:

var today = new Date().getTime();

if it is the "now" timestamp that you seek.

karim79
  • 339,989
  • 67
  • 413
  • 406
  • thx, the error has gone, but I don't get the date on the server? – mfadel Apr 23 '12 at 13:26
  • well I am seeking the date only, I am checking this now, http://stackoverflow.com/questions/1531093/how-to-get-current-date-in-javascript – mfadel Apr 23 '12 at 13:27
  • well I will insert the date using MySQl, it solved this problem for now, but for general use I am sending date as string then parsing it in PHP – mfadel Apr 24 '12 at 06:29