dimanche 28 juin 2015

Serialize jQuery Variables

I would like to make an AJAX POST to a php script and send over the following variables. I had a look at the jQuery documentation but I struggled to understand its' use anywhere outside of forms.

var amount = $('input[name=amount]').val();
var chance = $('input[name=chance]').val();

These are two decimal values, how could I format them to send them as the data field in an AJAX post request?

If serialize() is not the way to go, what is?

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire