如何从这里获得身份证?
JsonResponse {#457 ▼
#data: "{"bill":{"id":11,"invoice_no":"9m36r9_1459170388239"}}"
#callback: null
}我是从这个laravel代码得到这个输出的
return Response::json($response);我尝试了json_decode,但在这里没有工作,一个空白的输出即将到来。
谢谢你的帮助。
发布于 2016-03-29 07:58:13
试着像这样
$jsonResponse = Response::json([
'id' => 1,
'test' => 'test'
]);
$content = $jsonResponse->getContent();
$array = json_decode($content, true);
$id = $array['id']发布于 2019-08-20 04:27:48
这对我适用,使用getData()。Laravel 5.7
$jsonResponse = Response::json([
'id' => 1,
'test' => 'test'
]);
$content = $jsonResponse->getData();
$id = $content->id;发布于 2016-03-29 07:47:03
试试这个,它对我有用:
$.ajax({
type: "POST",
url: url,
data: {
...
},
success: function (data) {
alert(data.bill.id)
},
error: function (err) {
}
});如果这不管用就告诉我。
https://stackoverflow.com/questions/36278112
复制相似问题