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

asp.net - Change the driver in the connection string to a data source in VB.Net -

Getting started consuming web services in a Ruby on Rails 3 application -

objective c - iPhone and it's wireless area -