如何从Cordova应用程序向服务器发送大量数据

时间:2019-02-09 04:04:32

标签: javascript jquery rest api cordova

我正在使用jquery序列化将表单数据从cordova应用程序发送到PHP服务器,该表单是用于用户订单的动态购物车,可处理30-35个项目,但是当用户尝试发送更多项目时,应用程序将失败。

我们在php.ini中将post_max_size = 8M更改为30M,但它也失败了。

这是表格的一部分...

<li class="checkoutrow" style="position: relative;">
<input type="hidden" name="idproduct[]" value="'+cart[i].idproduct+'" id="idproduct" class="idproduct">
<input type="hidden" name="cod_prod[]" value="'+cart[i].cod_prod+'" id="cod_prod" class="cod_prod">
<input type="hidden" name="subtotal[]" value="'+subtotalneto+'" >
<input type="hidden" name="subtotaliva[]" value="'+subtotaliva+'" >
<h3 class="product-name">
<textarea name="description[]" style="width: 90%; color: #ae0000;" rows="2" readonly>'+cart[i].description+'</textarea>
</h3>
<span class="cart-delete"><a onclick="delete_cart_item('+i+', this);" href="#"><i class="fa fa fa-times"></i></a></span>
<div class="table">
<div class="qty col" style="width: 20%;"><input style="width: 98%; border: none;" type="number" name="qty[]" value="'+cart[i].qty+'" readonly ></div>
<div class="price col" style="width: 27%;"><input style="width: 98%; border: none;"  type="text" name="price[]" value="'+cart[i].price+'" readonly></div>
<div class="col" style="width: 23%;"><input type="text" style="width: 98%; border: none; text-align: center;" name="descuento[]" value="'+cart[i].descuento+'" readonly></div>
<div class="subtotalitem col" style="width: 30%;"><input style="width: 98%; border: none; text-align: right;" type="text" name="subtotalitem[]" value="'+subtotalitem+'" readonly></div>
</div></li>

1 个答案:

答案 0 :(得分:0)

最后,它仅在我发送30到40件物品时有效。我解决了对数据进行分页的问题。当检测到最后一个包裹时,我会更改订单状态并按发送状态提供。