I want to send multidimensional array in angularjs. The request is sending from angularjs UI to Laravel API side, In API side I need the input as
array:3 [
0 => array:3 [
"title" => "name1"
"type" => "type1"
"rate" => 11
]
1 => array:3 [
"title" => "name2"
"type" => "type2"
"rate" => 31
]
2 => array:3 [
"title" => "name3"
"type" => "type3"
"rate" => 13.333
]
]
But I not getting so. The static data I am trying to send from angular is
var values = [
{
"title" => "name1"
"type" => "type1"
"rate" => 11
},
{
"title": "Make an offer Rate",
"type": "make_offer_rate",
"rate": 30
},
{
"title": "Test price",
"type": "test_rate",
"rate": 100
}
];
$http({
method: 'POST',
url: urls.api_url_serv+'rate?token='+token,
transformRequest: transformRequestAsFormPost,
data: {
rates:JSON.stringify(values),
},
withCredentials: false,
headers: {
'Accept': 'application/json',
'Content-Type': "application/x-www-form-urlencoded"
};
Its getting as string in API side When I tried to dd() the Response was
"[{"title":"name1","type":"type1","rate":45},{"title":"name2","type":"type2","rate":30},{"title":"name3","type":"type3","rate":100}]"
I need to handle it from UI side since the API section is not done by me
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire