这里简单的问题。我想在 ajax 请求中发送两个字符串作为数据。问题在于这个 ajax 请求它只发送第二个数据串,而不是第一个。我将如何在一个 ajax 请求中发送这两个?
$.ajax({ url: '#{add_cards_path}',
type: 'POST',
beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', '#{form_authenticity_token}')},
dataType: "json",
data: 'credit_uri=' + response.data.uri,
data: 'address=' + $('.address').val(),
success: function(response) {
window.location.assign(location.protocol + '//' + location.host);
}
});
我想发送“credit_uri”和“address”。如何?