-4

What would be the equivalent of using AJAX rather than sending a form in this case

<form action="" method="post">
 <div style="padding-left: 10 px:"></div>
 <input id ="datetime" style="display:none;" type="text" name="datetime" VALUE="yyyy/MM/dd HH:mm:ss" SIZE="5"   > 
 <A  HREF="#" onClick="cal.select(document.forms[0].datetime,'anchor','MM/dd/yyyy'); return false;"             
     TITLE="cal.select(document.forms['example'].datetime,'anchor','MM/dd/yyyy'); return false;" 
     NAME="anchor" ID="anchor"><i class="icon-calendar"></i>
 </A>
 <input style="font-size: Bold 8pt;" id = "done" type="submit" value="Done" />
</form>

I want to use the AJAX post to get my new variables rather than sending the form.

Talentz
  • 1
  • 1
  • 6

1 Answers1

0

It would just be

$("#done").click(function() {
    $.post("/",{"datetime": $("#datetime").val()});
    return false;
})

More about $.post: http://api.jquery.com/jQuery.post/

Alfred Xing
  • 4,406
  • 2
  • 23
  • 34