我在PayPal for HATEOS上有以下示例。我想访问该链接,但是我的浏览器在语法错误方面存在问题。
SyntaxError:missing)参数列表[Break On This Error]
之后警报(links.1.href);
(第32行,第15栏)
JSON来自paypal,我试图访问链接
{
"id": "PAY-23P72370PE379301LKIWIOTQ",
"create_time": "2013-09-08T14:18:54Z",
"update_time": "2013-09-08T14:18:54Z",
"state": "created",
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
"transactions": [
{
"amount": {
"total": "7.47",
"currency": "USD",
"details": {
"subtotal": "7.47"
}
},
"description": "payment using a PayPal account"
}
],
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-23P72370PE379301LKIWIOTQ",
"rel": "self",
"method": "GET"
},
{
"href": "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-8DG907196F781211F",
"rel": "approval_url",
"method": "REDIRECT"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-23P72370PE379301LKIWIOTQ/execute",
"rel": "execute",
"method": "POST"
}
]
}
如何访问REDIRECT的链接?
alert(links.1.href);
由于
答案 0 :(得分:1)
答案 1 :(得分:0)
发现它!
警报(data.links [1] .href);
由于