I am trying to call a handleResponse function and its stating that it is undefined. I cant seem to figure it out as they are in the same $document.ready function.
jQuery ->
handleResponse(response) ->
if (response.status_code == 201)
fundingInstrument = response.cards != null ? response.cards[0]
jQuery.post("models/Tablecharge",
uri : fundingInstrument.href,
(r) ->
if (r.status == 201)
redirect_to @table
else
render 'new'
)
$('#cc-submit').click (e) ->
e.preventDefault()
payload =
name: $('#cc-name').val()
number: $('#cc-number').val(),
expiration_month: $('#cc-ex-month').val(),
expiration_year: $('#cc-ex-year').val(),
cvv: $('#ex-cvv').val(),
balanced.card.create(payload, handleResponse())
You need
balanced.card.create(payload, handleResponse)
rather than
balanced.card.create(payload, handleResponse())
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.