javascript - Chaining functions: Creating .post variable from on click event in JQuery -
i'm attempting create post value on click event.
from here:
$(document).ready(function(){ $("div").click(function(){ var pastdate = $(this).text(); alert(pastdate); }); //end click }); //end ready
i've tried numerous variations on next code in effort post variable work missing critical.
$(document).ready(function(){ $("div").click(function(){ var pastdate = $(this).text.post("calendarfunction.php", function() { alert("success"); }) .done(function() { alert("second success"); }) .fail(function() { alert("error" ); }) .always(function() { alert("finished"); }); });
the error console telling me have undefined object. can show me how prepare this?
you've gotten pastdate
have send post request.
http://api.jquery.com/jquery.post/
the sec param of jquery.post info sent
var pastdate = $(this).text() $.post('url', pastdate, function() { });
what sort of info php script expecting? key expecting might need key post value
var info = { yourkey: pastdate } $.post('url', data, function() {});
javascript jquery post
No comments:
Post a Comment