save javascript function to mysql -


How can I save mysql from the javascript function ??

  var macs = {GetMacAddress: function () {document.macaddressapplet.SetSep ("-"); Return (document.macaddressapplet.getMacAddress ()); }} Document.write (macs.getMacAddress ());  

Someone told me to use Ajax, but ive tried to find out but found nothing. Nobody would be good to help me.

AJAX The way to do this is that you can do this with vanilla javascript, but this is dirty. Personally, I always use a library for which my favorite choice is mine. Then your code goes:

  & lt; Input type = "button" id = "sendmac" value = "send MAC address" & gt; With  

:

  $ (function () {$ ("# sendmac") click (function () {document.macaddressapplet.SetSep ( "-"); $ .post ("savemacaddress.php", {getMacAddress: document.macaddressapplet.getMacAddress ()});});});  

savemacaddress.php:

   

Assume that you are using PHP.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -