本文介绍了将值从jquery传递到PHP而不提交页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 在餐厅网站工作。我想给顾客选择食品,因为他们可以修改他们的餐饮订单,我使用jquery将选择价值传递给隐藏领域的餐饮订单。但是餐饮订单上没有显示该值!如何将值从jquery传递给php? 我尝试过:working on restaurant webiste. and i wanted to give choice for the food item to the customer as they can modify their catering order,i have use jquery to pass choice value to catering order form by hidden field. but that value doesn't displayed on catering order form! how to pass value from jquery to php ?What I have tried:<!-- choice --><div class="label_input_group"><!--<div class="col-md-3">--><label class="pull-left row hidden"><?php echo $lang['cp_order_choice']; ???></label><input type="text" class="hidden col-md-3 list_of_choice form-control" id="order_choice" name="order_choice" value="aaa"/><!--<div class="menuitemids goeshere row">--><div class="cart_choice_goes_up"></div> <!-- </div>--><!--</div>--></div><!-- size --><div class="label_input_group"><!--<div class="col-md-2">--><label class="pull-left row hidden"><?php echo $lang['cp_order_size']; ???></label><input type="text" class="hidden col-md-2 list_of_size form-control" id="order_size" name="order_size" value=""/><div class="cart_size_goes_up"></div><!--</div>--></div>php<div class="move_menu_item_inputs"><input class=" choice" type="hidden" name="menu_item_choice" value="<?php echo $result3['menu_item_choice']; ???>"/><input class=" size" type="hidden" name="menu_item_size" value="<?php echo $result3['menu_item_size']; ???>"/><input class="single_menu_item" type="hidden" name="menu_item_id[]" value="<?php echo $result3['menu_item_id']; ???>" /><input disabled="disabled" class="single_menu_item menu_item_price_per_slice" type="hidden" name="menu_item_price_per_slice[]" value="<?php echo $result3['menu_item_price_per_slice']; ???>" /><input class="single_menu_item item_name col-md-8 form-control" readonly="readonly" type="text" name="menu_item_name[]" value="<?php echo $result3['menu_item_name']; ???>" /><input class="single_menu_item temporary_price_foreach_product" type="hidden" value="" /><button aria-hidden="true" class="form-control remove-product-from-cart single_menu_item" type="button">×</button><div class="single_menu_item col-md-2"> <input type="text" value="1" class="pull-left row plus-minus-qty form-control" name="plus_minus_qty[]" /></div></div>JS\ var choicetotal = ''; jQuery('.cart_choice_goes_up .choice').each(function(){ //count total choice in cart choicetotal += jQuery(this).val(); //jQuery('input.list_of_choice').val( choicetotal ); });jQuery('input.list_of_choice').html(choicetotal); //place item choice value console.log("choice :- "+choicetotal);var sizetotal = ''; jQuery('.cart_size_goes_up .size').each(function(){ //count total size in cart sizetotal += jQuery(this).val(); //jQuery('input.list_of_size').val( sizetotal );<!--$('#order_size').val("sizetotal");--> });jQuery('input.list_of_size').html(sizetotal); //place item size value console.log("size :- "+sizetotal);推荐答案 这篇关于将值从jquery传递到PHP而不提交页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-15 17:10