Skip to content Skip to sidebar Skip to footer

How Can I Set Data-* Attributes On The Button When The AJAX Requests Complete?

This is a follow up question for the one asked before https://stackoverflow.com/a/33550107/4662074 And to be honest I just need a hint here. I have the jquery validate submit hand

Solution 1:

Use jquery data instead:

$("#submitForm").data('transaction', transactionID);

And

var number_id = $("#submitForm").data('transaction');

Notice that this will not add the attribute to the DOM, if you inspect the element via the developers tool, you won't see data-transaction, but the element will have the data referenced.

Edit:

Your method should also work, but as @Tushar pointed out, you are missing the # from your selector: $("submitForm") -> $("#submitForm")


Post a Comment for "How Can I Set Data-* Attributes On The Button When The AJAX Requests Complete?"